From d0ae279ff3b83358d1c07f4481a041c4ad335026 Mon Sep 17 00:00:00 2001 From: dangsn <dangsn@chicecm.com> Date: 星期二, 03 十二月 2024 11:57:38 +0800 Subject: [PATCH] 提取业务系统使用的功能,独立出一个单独的模块 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java | 938 ++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 548 insertions(+), 390 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 52ae8d9..1ce66c2 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 @@ -1,16 +1,26 @@ package com.vci.web.service.impl; -import com.vci.client.bof.ClientBusinessObject; -import com.vci.client.bof.ClientLinkObject; -import com.vci.client.bof.RevisionValueObject; -import com.vci.client.bof.VersionValueObject; -import com.vci.client.common.providers.ClientServiceProvider; +import com.vci.client.common.oq.OQTool; +import com.vci.common.qt.object.QueryTemplate; import com.vci.corba.common.PLException; -import com.vci.corba.omd.data.*; +import com.vci.corba.framework.data.UserInfo; +import com.vci.corba.omd.data.BusinessObject; +import com.vci.corba.omd.data.LinkObject; +import com.vci.corba.omd.data.RevisionDataInfo; +import com.vci.corba.omd.data.VersionDataInfo; import com.vci.corba.omd.lcm.LifeCycle; -import com.vci.file.pagemodel.VciFileObjectVO; -import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; -import com.vci.frameworkcore.lcstatuspck.ReleaseDataLCStatus; +import com.vci.corba.omd.ltm.LinkType; +import com.vci.corba.omd.qtm.QTInfo; +import com.vci.corba.query.data.BOAndLO; +import com.vci.dto.*; +import com.vci.lcstatuspck.FrameworkDataLCStatus; +import com.vci.lcstatuspck.ReleaseDataLCStatus; +import com.vci.omd.utils.ObjectTool; +import com.vci.pagemodel.*; +import com.vci.query.UIDataGridQuery; +import com.vci.query.UIFormQuery; +import com.vci.query.UILinkTypeDataQuery; +import com.vci.query.UITreeQuery; import com.vci.starter.revision.bo.TreeWrapperOptions; import com.vci.starter.web.annotation.bus.VciChangeDataAfter; import com.vci.starter.web.annotation.bus.VciChangeDataBefore; @@ -22,28 +32,27 @@ import com.vci.starter.web.model.BaseModel; import com.vci.starter.web.pagemodel.*; import com.vci.starter.web.util.*; +import com.vci.starter.web.util.Lcm.Func; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; -import com.vci.web.dto.*; +import com.vci.web.enumpck.DeleteTypeEnum; import com.vci.web.enumpck.UIFieldTypeEnum; import com.vci.web.enumpck.UITreeLoadTypeEnum; -import com.vci.web.pageModel.*; -import com.vci.web.query.UIDataGridQuery; -import com.vci.web.query.UIFormQuery; -import com.vci.web.query.UILinkTypeDataQuery; -import com.vci.web.query.UITreeQuery; import com.vci.web.service.*; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; +import org.dom4j.DocumentHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.lang.reflect.Method; import java.util.*; import java.util.stream.Collectors; -import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; +import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; + /** * UI涓婄殑鏁版嵁鏌ヨ @@ -70,6 +79,11 @@ */ @Autowired private OsBtmServiceI btmService; + /** + * 灞炴�ф湇鍔� + */ + @Autowired + private OsAttributeServiceI attrService; /** * 閾炬帴绫诲瀷 @@ -131,11 +145,11 @@ * @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(); - String queryTemplate = !CollectionUtils.isEmpty(dataGridQuery.getSourceData())?dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()):tableDefineVO.getQueryTemplateName(); + UITableDefineVO tableDefineVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid(),null).getTableDefineVO(); + String queryTemplate = !CollectionUtils.isEmpty(dataGridQuery.getSourceData())? (String) dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()) :tableDefineVO.getQueryTemplateName(); if(StringUtils.isBlank(queryTemplate)){ //璇存槑娌℃湁璁剧疆鏌ヨ妯℃澘锛岄渶瑕佺湅鐪嬪湪杩欎釜琛ㄦ牸鎵�鍦ㄧ殑缁勪欢鏈夋病鏈夎缃� tableDefineVO = uiEngineService.getTableById(dataGridQuery.getBtmname(), dataGridQuery.getTableDefineId()); @@ -172,14 +186,15 @@ queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); }else{ - btmTypeVO = btmService.getBtmById(dataGridQuery.getBtmname()); + //btmTypeVO = btmService.getBtmById(dataGridQuery.getBtmname()); + btmTypeVO = btmService.getBtmByName(dataGridQuery.getBtmname()); queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); } queryFieldList.add("creator_name"); queryFieldList.add("lastmodifier_name"); //鎴戜滑鍦ㄥ悗鍙版煡璇笟鍔℃暟鎹� - Map<String, String> replaceMap = wrapperReplaceMap( dataGridQuery.getSourceData()); + Map<String, Object> replaceMap = wrapperReplaceMap(dataGridQuery.getSourceData()); if(dataGridQuery.isLinkTypeFlag()){ UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); @@ -193,8 +208,9 @@ } return loService.queryGridByScheme(linkTypeDataQuery); }else { - return boService.queryGridByScheme(queryTemplate, + DataGrid dataGrid = boService.queryGridByScheme(queryTemplate, dataGridQuery.getConditionMap(), replaceMap, dataGridQuery.getPageHelper(), queryFieldList.stream().collect(Collectors.toList())); + return dataGrid; } //鐢熷懡鍛ㄦ湡鍦ㄥ叾涓煡璇㈠悗灏变細澶勭悊 //鏋氫妇涔熶細琚鐞嗕簡 @@ -208,10 +224,10 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public UIFormDataVO getDataForForm(UIFormQuery formQuery) throws VciBaseException { + public UIFormDataVO getDataForForm(UIFormQuery formQuery) throws VciBaseException, PLException { VciBaseUtil.alertNotNull(formQuery,"琛ㄥ崟鐨勬煡璇㈠璞�",formQuery.getBtmname(),"涓氬姟绫诲瀷鐨勪俊鎭�",formQuery.getOid(),"涓氬姟鏁版嵁鐨勪富閿�",formQuery.getFormDefineId(),"琛ㄥ崟鐨勫畾涔夌紪鍙�"); UIFormDefineVO formDefineVO = uiEngineService.getFormById(formQuery.getBtmname(),formQuery.getFormDefineId()); - String queryTemplate = !CollectionUtils.isEmpty(formQuery.getSourceData())?formQuery.getSourceData().getOrDefault("querytemplate",formDefineVO.getQueryTemplateName()):formDefineVO.getQueryTemplateName(); + String queryTemplate = !CollectionUtils.isEmpty(formQuery.getSourceData())? (String) formQuery.getSourceData().getOrDefault("querytemplate",formDefineVO.getQueryTemplateName()) :formDefineVO.getQueryTemplateName(); Set<String> queryFieldList = formDefineVO.getItems().stream().filter(s->!UIFieldTypeEnum.CUSTOM.getValue().equalsIgnoreCase(s.getType())).map(UIFormItemVO::getField).collect(Collectors.toSet()); //鑾峰彇鍙傜収 List<UIFormItemVO> referFieldList = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getType())).collect(Collectors.toList()); @@ -238,17 +254,17 @@ queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); }else{ - btmTypeVO = btmService.getBtmById(formQuery.getBtmname()); + btmTypeVO = btmService.getBtmByName(formQuery.getBtmname()); queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); } queryFieldList.add("creator_name"); queryFieldList.add("lastmodifier_name"); Map<String,String> conditionMap = WebUtil.getOidQuery(formQuery.getOid()); - Map<String, String> replaceMap = wrapperReplaceMap(formQuery.getSourceData()); + Map<String, Object> replaceMap = wrapperReplaceMap(formQuery.getSourceData()); UIFormDataVO formDataVO = new UIFormDataVO(); replaceMap.put("oid", formQuery.getOid().trim()); if(!formDefineVO.isLinkTypeFlag()) { - List<com.vci.client.bof.ClientBusinessObject> cbos = null; + List<BusinessObject> cbos = null; if (StringUtils.isNotBlank(queryTemplate)) { replaceMap.put("oid", formQuery.getOid().trim()); cbos = boService.queryCBOByScheme(queryTemplate, conditionMap, replaceMap, null, queryFieldList.stream().collect(Collectors.toList())); @@ -257,7 +273,7 @@ cbos = boService.queryCBO(formQuery.getBtmname(), conditionMap, null, queryFieldList.stream().collect(Collectors.toList())); } if (!CollectionUtils.isEmpty(cbos)) { - com.vci.client.bof.ClientBusinessObject cbo = cbos.get(0); + BusinessObject cbo = cbos.get(0); formDataVO.setData(boService.cbo2Map(cbo)); } else { throw new VciBaseException(DATA_OID_NOT_EXIST); @@ -314,13 +330,14 @@ * @param sourceDataMap 鏉ユ簮鏁版嵁 * @return 鏇挎崲鍚庣殑鍊� */ - private Map<String,String> wrapperReplaceMap(Map<String,String> sourceDataMap){ - Map<String,String> replaceMap =!CollectionUtils.isEmpty(sourceDataMap)? sourceDataMap:new HashMap<>(); + private Map<String,Object> wrapperReplaceMap(Map<String,Object> sourceDataMap){ + Map<String,Object> replaceMap =!CollectionUtils.isEmpty(sourceDataMap)? sourceDataMap:new HashMap<>(); if(!replaceMap.containsKey("f_oid")){ replaceMap.put("f_oid",replaceMap.getOrDefault("oid","")); } - if(replaceMap.get("f_oid").contains(TREE_NODE_ID_SEP)){ - replaceMap.put("f_oid",replaceMap.get("f_oid").split(TREE_NODE_ID_SEP)[1]); + String fOid = replaceMap.get("f_oid").toString(); + if(fOid.contains(TREE_NODE_ID_SEP)){ + replaceMap.put("f_oid",fOid.split(TREE_NODE_ID_SEP)[1]); } return replaceMap; } @@ -338,9 +355,10 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public List<Tree> getDataForTree(UITreeQuery treeQuery) throws VciBaseException { + public List<UIDataTree> getDataForTree(UITreeQuery treeQuery) throws Exception { 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("鏍戠殑閰嶇疆淇℃伅娌℃湁鑾峰彇鍒�"); } @@ -352,14 +370,21 @@ if(!treeQuery.isLinkTypeFlag() && StringUtils.isBlank(treeQuery.getParentBtmName())){ treeQuery.setParentBtmName(treeQuery.getBtmname()); } - + //TODO: 鏇挎崲鏍戝畾涔変笂鐨勬鍙嶅悜鏌ヨ灞炴�э紝鍥犱负姝e弽鍚戞煡璇㈡槸鐢遍摼鎺ョ被鍨嬫煡璇㈡ā鏉夸笂鎺у埗鐨� + boolean isOrientation = false; //鏄惁鍙嶅悜锛屼娇鐢ㄦā鏉夸笂閰嶇疆鐨� + String qtName = treeDefineVO.getQueryTemplateName(); + if(Func.isNotBlank(treeDefineVO.getLinkType()) && Func.isNotBlank(qtName)){ + QTInfo wrapper = platformClientUtil.getQTDService().getQT(qtName); + QueryTemplate qt = OQTool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), qtName); + isOrientation = qt.getDirection().equals("opposite"); + } if(treeQuery.getConditionMap() == null){ treeQuery.setConditionMap(new HashMap<>()); } if(treeQuery.getExtandParamsMap() != null){ treeQuery.getConditionMap().putAll(treeQuery.getExtandParamsMap()); } - String parentFieldName = treeQuery.getParentFieldName(); + String parentFieldName = treeQuery.getParentFieldName(); if(parentFieldName.contains(",")){ parentFieldName = parentFieldName.split(",")[0]; } @@ -371,19 +396,19 @@ if(StringUtils.isNotBlank(treeQuery.getParentOid()) && treeQuery.getParentOid().contains(TREE_NODE_ID_SEP)){ treeQuery.setParentOid(treeQuery.getParentOid().split(TREE_NODE_ID_SEP)[1]); } - String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())?treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()):treeDefineVO.getQueryTemplateName()); - String valueField = treeQuery.isLinkTypeFlag()?(!treeDefineVO.isOrientation()?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid"); + String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())? (String) treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()) :treeDefineVO.getQueryTemplateName()); + String valueField = treeQuery.isLinkTypeFlag()?(!isOrientation?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid"); String textField = StringUtils.isNotBlank(treeDefineVO.getTreeNodeExpression())?treeDefineVO.getTreeNodeExpression():(StringUtils.isNotBlank(treeQuery.getTextField())?treeQuery.getTextField():"name"); - List<Tree> rootTreeList = new ArrayList<>(); + List<UIDataTree> rootTreeList = new ArrayList<>(); List<String> queryFieldList = new ArrayList<>(); queryFieldList.add("creator_name"); queryFieldList.add("lastmodifier_name"); String rootExpress = StringUtils.isNotBlank(treeQuery.getRootExpress())?treeQuery.getRootExpress():treeDefineVO.getRootContent(); - Map<String, String> replaceMap = wrapperReplaceMap(treeQuery.getSourceData()); + Map<String, Object> replaceMap = wrapperReplaceMap(treeQuery.getSourceData()); if(StringUtils.isBlank(treeDefineVO.getLinkType())){ //杩欎釜鏄笟鍔$被鍨嬬殑鑷弬鐓� //浠ュ墠鐨勫钩鍙版病鏈夊鑷弬鐓ц繖绉嶆湁鍏ㄩ儴鏌ヨ鐨� - OsBtmTypeVO btmTypeVO = btmService.getBtmById(treeDefineVO.getBtmType()); + OsBtmTypeVO btmTypeVO = btmService.getBtmByName(treeDefineVO.getBtmType()); queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); @@ -392,7 +417,7 @@ if(treeQuery.isQueryRoot()){ //鏄煡璇㈡牴鑺傜偣 - List<com.vci.client.bof.ClientBusinessObject> rootCbos = null; + List<BusinessObject> rootCbos = null; if(StringUtils.isNotBlank(queryTemplate)){ //璇存槑鏄彍鍗曢噷瀹氫箟浜嗘煡璇㈡ā鏉跨殑 rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap); @@ -402,7 +427,7 @@ if(StringUtils.isBlank(parentFieldNameAndValue) || !parentFieldNameAndValue.contains(",")){ throw new VciBaseException("閰嶇疆鐨勪俊鎭湁璇�傚湪娌℃湁鍦ㄨ彍鍗曟垨鑰呮潵婧愭暟鎹缃牴鑺傜偣鐨勬煡璇㈡ā鏉挎椂锛岃鍦ㄦ爲鐨勩�愬弬鐓ф爲銆戜笂璁剧疆涓婄骇瀛楁鐨勫悕绉板拰鏍硅妭鐐圭殑鏌ヨ鐨勫�笺�傛瘮濡倄xxx,yyy銆傚叾涓瓁xxx鏄笂绾у瓧娈佃嫳鏂囧悕绉�"); } - parentFieldName= parentFieldNameAndValue.split(",")[0]; + parentFieldName = parentFieldNameAndValue.split(",")[0]; String rootQueryValue = parentFieldNameAndValue.split(",")[1]; treeQuery.getConditionMap().put(parentFieldName,rootQueryValue); replaceMap.put(parentFieldName,rootQueryValue); @@ -428,7 +453,7 @@ return rootTreeList; }else{ //杩欎釜涓嶆槸璺熻妭鐐癸紝浣嗘槸涓�鑸彧鏄鍔犱竴涓�愮骇鏌ヨ锛屽洜涓哄叏閮ㄦ煡璇㈢殑鏃跺�欙紝鍦ㄦ牴鑺傜偣宸茬粡鍏ㄩ儴鏌ヨ瀹屼簡 - List<com.vci.client.bof.ClientBusinessObject> thisChildren = null; + List<BusinessObject> thisChildren = null; if (StringUtils.isNotBlank(queryTemplate)) { thisChildren = boService.queryCBOByScheme(queryTemplate, treeQuery.getConditionMap(), replaceMap, null, queryFieldList); } else { @@ -437,8 +462,10 @@ return cbo2Trees(thisChildren, valueField, textField, parentFieldName, treeQuery.isShowCheckBox(), null); } }else{ - OsLinkTypeVO linkTypeVO = linkTypeService.getLinkTypeById(treeDefineVO.getLinkType()); - queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); + //OsLinkTypeVO linkTypeVO = linkTypeService.getLinkTypeById(treeDefineVO.getLinkType()); + LinkType linkType = platformClientUtil.getLinkTypeService().getLinkType(treeDefineVO.getLinkType()); + //queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); + queryFieldList.addAll(Arrays.asList(linkType.attributes)); queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); addQueryField(queryFieldList,valueField); @@ -449,7 +476,7 @@ linkTypeDataQuery.setConditionMap(treeQuery.getConditionMap()); linkTypeDataQuery.setParentOid(treeQuery.getParentOid()); linkTypeDataQuery.setClauseList(queryFieldList); - linkTypeDataQuery.setDirection(treeDefineVO.isOrientation()); + linkTypeDataQuery.setDirection(isOrientation); linkTypeDataQuery.setToBtmType(treeDefineVO.getBtmType()); linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ @@ -457,7 +484,7 @@ } if(treeQuery.isQueryRoot()){ //鏌ヨ鏍硅妭鐐�.鎴戜滑闇�瑕佸垽鏂槸鍚﹁缃簡鏍硅妭鐐圭殑鏌ヨ鏉′欢 - List<com.vci.corba.query.data.BOAndLO> rootCbos = null; + List<BOAndLO> rootCbos = null; String parentFieldNameAndValue = treeDefineVO.getShowLinkAbs(); if(StringUtils.isNotBlank(parentFieldNameAndValue)){ if(StringUtils.isNotBlank(queryTemplate)){ @@ -479,7 +506,7 @@ } if(!CollectionUtils.isEmpty(rootCbos)){ if(StringUtils.isBlank(parentFieldName)){ - if(treeDefineVO.isOrientation()){ + if(isOrientation){ parentFieldName = "t_oid"; }else{ parentFieldName = "f_oid"; @@ -499,15 +526,15 @@ if(CollectionUtils.isEmpty(replaceMap)){ throw new VciBaseException("鏍硅妭鐐规病鏈夐厤缃煡璇㈡潯浠讹紝涔熸病鏈夋潵婧愭暟鎹�"); } - Tree root = new Tree(); - root.setOid(replaceMap.getOrDefault("oid",replaceMap.getOrDefault("t_oid",""))); + UIDataTree root = new UIDataTree(); + root.setOid((String) replaceMap.getOrDefault("oid",replaceMap.getOrDefault("t_oid",""))); root.setText(getValueByExpressForBOAndLO(new HashMap<>(),replaceMap,rootExpress)); root.setAttributes(replaceMap); root.setIndex("0"); rootTreeList.add(root); if(StringUtils.isBlank(parentFieldName)){ - if(treeDefineVO.isOrientation()){ + if(isOrientation){ parentFieldName = "t_oid"; }else{ parentFieldName = "f_oid"; @@ -527,11 +554,74 @@ if(linkTypeDataQuery.getReplaceMap() == null){ linkTypeDataQuery.setReplaceMap(new HashMap<>()); } - linkTypeDataQuery.getReplaceMap().put(treeDefineVO.isOrientation()?"t_oid":"f_oid",treeQuery.getParentOid()); + linkTypeDataQuery.getReplaceMap().put(isOrientation?"t_oid":"f_oid",treeQuery.getParentOid()); } return cloAndCbo2Trees(loService.queryCLOAndBoByLinkType(linkTypeDataQuery),valueField,textField,parentFieldName,treeQuery.isShowCheckBox(),treeQuery.getParentOid()); } } + } + + /** + * 鑾峰彇鏁版嵁(鏍规嵁鏌ヨ妯℃澘鏌ヨ瀵硅薄锛岃繑鍥炵殑缁撴瀯鎸夌収ui瀹氫箟锛屽畾涔夌殑妯℃澘绫诲瀷杩斿洖) + * @param treeQuery 鏍戝舰鏌ヨ鏉′欢 + * @return 鏍戝舰鏁版嵁 + * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 + */ + @Override + public BaseResult getDataByTemp(UITreeQuery treeQuery) throws Exception { + VciBaseUtil.alertNotNull(treeQuery,"琛ㄥ崟鐨勬煡璇㈠璞�",treeQuery.getComponentOid(),"褰撳墠缁勪欢鐨勪富閿�"); + //1銆佸厛鏌ヨ椤甸潰瀹氫箟缁勪欢 + Map<String, OsAttributeVO> attributeVOMap = attrService.selectAllAttributeMap(); + UIComponentVO componentVO = uiEngineService.getComponentByOid(treeQuery.getComponentOid(),attributeVOMap); + if(componentVO == null || StringUtils.isBlank(componentVO.getOid())){ + throw new VciBaseException("鏈幏鍙栧埌鐣岄潰閰嶇疆淇℃伅锛�"); + } + // 2銆佹牴鎹厤缃殑鏌ヨ妯℃澘鏌ヨ鏁版嵁(闇�瑕佽�冭檻鍏ㄩ潰涓�鐐�), + // 杩欏効鏍规嵁褰撳墠绫诲瀷鏉ヨ幏鍙栨槸浠�涔堢被鍨嬬殑鏌ヨ妯℃澘锛岀劧鍚庡仛瀵瑰簲鐨勬煡璇㈠鐞� + //TODO: 鏇挎崲鏍戝畾涔変笂鐨勬鍙嶅悜鏌ヨ灞炴�э紝鍥犱负姝e弽鍚戞煡璇㈡槸鐢遍摼鎺ョ被鍨嬫煡璇㈡ā鏉夸笂鎺у埗鐨� + UITreeDefineVO treeDefineVO = componentVO.getTreeDefineVO(); + boolean isOrientation = false; //鏄惁鍙嶅悜锛屼娇鐢ㄦā鏉夸笂閰嶇疆鐨� + String qtName = treeDefineVO.getQueryTemplateName(); + if(Func.isNotBlank(treeDefineVO.getLinkType()) && Func.isNotBlank(qtName)){ + QTInfo wrapper = platformClientUtil.getQTDService().getQT(qtName); + QueryTemplate qt = OQTool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), qtName); + isOrientation = qt.getDirection().equals("opposite"); + } + String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())? (String) treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()) :treeDefineVO.getQueryTemplateName()); + Map<String, Object> replaceMap = wrapperReplaceMap(treeQuery.getSourceData()); + List<String> queryFieldList = new ArrayList<>(); + String valueField = treeQuery.isLinkTypeFlag()?(!isOrientation?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid"); + String textField = StringUtils.isNotBlank(treeDefineVO.getTreeNodeExpression())?treeDefineVO.getTreeNodeExpression():(StringUtils.isNotBlank(treeQuery.getTextField())?treeQuery.getTextField():"name"); + String rootExpress = StringUtils.isNotBlank(treeQuery.getRootExpress())?treeQuery.getRootExpress():treeDefineVO.getRootContent(); + String parentFieldName = treeQuery.getParentFieldName(); + if(parentFieldName.contains(",")){ + parentFieldName = parentFieldName.split(",")[0]; + } + queryFieldList.add("creator_name"); + queryFieldList.add("lastmodifier_name"); + OsBtmTypeVO btmTypeVO = btmService.getBtmByName(treeDefineVO.getBtmType()); + queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); + queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); + + addQueryField(queryFieldList,valueField); + addQueryField(queryFieldList,textField); + List<BusinessObject> rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap); + + //3銆佹牴鎹笉鍚岀殑缁勪欢杩斿洖涓嶅悓鐨勬暟鎹被鍨嬶紙鏍戙�佸垪琛ㄣ�佹爲琛ㄣ�佽嚜瀹氫箟妯℃澘銆佽〃鍗曠瓑锛� + List<UIDataTree> rootTreeList = null; + if(!CollectionUtils.isEmpty(rootCbos)){ + rootTreeList = cbo2Trees(rootCbos,valueField,StringUtils.isBlank(rootExpress)?textField:rootExpress,parentFieldName,treeQuery.isShowCheckBox(),null); + TreeQueryObject treeQueryObject = new TreeQueryObject(); + treeQueryObject.setValueField(valueField); + treeQueryObject.setTextField(textField); + treeQueryObject.setParentFieldName(parentFieldName); + treeQueryObject.setShowCheckBox(treeQuery.isShowCheckBox()); + if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ + treeQueryObject.setQueryAllLevel(false); + } + //queryTreeForBO(rootTreeList,treeDefineVO.getQueryTemplateName(),queryFieldList,treeQueryObject); + } + return BaseResult.tree(rootTreeList); } /** @@ -541,19 +631,19 @@ * @param queryFieldList 鏌ヨ鐨勫瓧娈� * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄锛岄渶瑕乿alueField鍜宼extField锛岃繕鏈塸arentFieldName,鍜宑heckBox */ - private void queryTreeForBO(List<Tree> rootTreeList, String queryTemplate,List<String> queryFieldList,TreeQueryObject treeQueryObject) { - for (Tree rootTree : rootTreeList) { - List<com.vci.client.bof.ClientBusinessObject> thisChildren = null; - Map<String,String> sourceDataMap = rootTree.getAttributes(); + private void queryTreeForBO(List<UIDataTree> rootTreeList, String queryTemplate,List<String> queryFieldList,TreeQueryObject treeQueryObject) { + for (UIDataTree rootTree : rootTreeList) { + List<BusinessObject> thisChildren = null; + Map<String,Object> sourceDataMap = rootTree.getAttributes(); sourceDataMap.put("f_oid",rootTree.getOid()); Map<String,String> conditionMap = new HashMap<>(); conditionMap.put(treeQueryObject.getParentFieldName(),rootTree.getOid()); if (StringUtils.isNotBlank(queryTemplate)) { thisChildren = boService.queryCBOByScheme(queryTemplate, conditionMap, sourceDataMap, null, queryFieldList); } else { - thisChildren = boService.queryCBO(sourceDataMap.getOrDefault("btmname",sourceDataMap.getOrDefault("btmName",treeQueryObject.getParentBtmName())), conditionMap, null, queryFieldList); + thisChildren = boService.queryCBO((String) sourceDataMap.getOrDefault("btmname",sourceDataMap.getOrDefault("btmName",treeQueryObject.getParentBtmName())), conditionMap, null, queryFieldList); } - List<Tree> childrenTree = cbo2Trees(thisChildren, treeQueryObject.getValueField(), treeQueryObject.getTextField(), treeQueryObject.getParentFieldName(), treeQueryObject.isShowCheckBox(), null); + List<UIDataTree> childrenTree = cbo2Trees(thisChildren, treeQueryObject.getValueField(), treeQueryObject.getTextField(), treeQueryObject.getParentFieldName(), treeQueryObject.isShowCheckBox(), null); rootTree.setChildren(childrenTree); if(treeQueryObject.isQueryAllLevel() && !CollectionUtils.isEmpty(childrenTree) ) { queryTreeForBO(childrenTree,queryTemplate,queryFieldList,treeQueryObject); @@ -570,8 +660,8 @@ * @param textField 鏄剧ず琛ㄨ揪寮� * @param showCheckBox 鏄惁鏄剧ず澶嶉�夋 */ - private void queryTreeForLO(List<Tree> rootTreeList, UILinkTypeDataQuery linkTypeDataQuery,String parentFieldName,String valueField,String textField,boolean showCheckBox) { - for (Tree rootTree : rootTreeList) { + private void queryTreeForLO(List<UIDataTree> rootTreeList, UILinkTypeDataQuery linkTypeDataQuery,String parentFieldName,String valueField,String textField,boolean showCheckBox) { + for (UIDataTree rootTree : rootTreeList) { Map<String,String> conditionMap = new HashMap<>(); conditionMap.put(linkTypeDataQuery.isDirection()?"t_oid":"f_oid",rootTree.getOid()); linkTypeDataQuery.setConditionMap(conditionMap); @@ -590,18 +680,21 @@ * @param parentOid 涓婄骇鐨勪富閿� * @return 鏍� */ - private List<Tree> cbo2Trees(Collection<com.vci.client.bof.ClientBusinessObject> cbos,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){ + private List<UIDataTree> cbo2Trees(Collection<BusinessObject> cbos,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){ final int[] i = {0}; - List<Tree> rootList = new ArrayList<>(); - List<Tree> children = new ArrayList<>(); + List<UIDataTree> rootList = new ArrayList<>(); + List<UIDataTree> children = new ArrayList<>(); cbos.stream().forEach(cbo->{ - Tree tree = new Tree(); + UIDataTree tree = new UIDataTree(); tree.setOid(getValueByExpress(cbo,valueField)); tree.setText(getValueByExpress(cbo,textField)); if(StringUtils.isNotBlank(parentFieldName)){ - tree.setParentId(cbo.getAttributeValue(parentFieldName)); + tree.setParentId(ObjectTool.getBOAttributeValue(cbo,parentFieldName)); } - tree.setAttributes(boService.cbo2Map(cbo)); + Map<String,Object> cbo2Map = boService.cbo2Map(cbo); + Map<String, Object> returnMap = new HashMap<>(); + returnMap.put((String) cbo2Map.get("btmname"),cbo2Map); + tree.setAttributes(returnMap); tree.setIndex(i[0] + ""); i[0]++; tree.setChecked(showCheckBox); @@ -615,7 +708,7 @@ if(rootList.size() == 0 && children.size() == 0){ return rootList; } - return Tree.getChildList(rootList,children); + return UIDataTree.getChildList(rootList,children); } /** @@ -628,36 +721,41 @@ * @param parentOid 涓婄骇鐨勫�� * @return 鏍戝舰鏁版嵁 */ - public List<Tree> cloAndCbo2Trees(Collection<com.vci.corba.query.data.BOAndLO> boAndLOS,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){ + public List<UIDataTree> cloAndCbo2Trees(Collection<BOAndLO> boAndLOS, String valueField, String textField, String parentFieldName, boolean showCheckBox, String parentOid){ final int[] i = {0}; - List<Tree> rootList = new ArrayList<>(); - List<Tree> children = new ArrayList<>(); + List<UIDataTree> rootList = new ArrayList<>(); + List<UIDataTree> children = new ArrayList<>(); boAndLOS.stream().forEach(boAndLO->{ - Tree tree = new Tree(); - com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); - cbo.setBusinessObject(boAndLO.bo); - com.vci.client.bof.ClientLinkObject clo = new com.vci.client.bof.ClientLinkObject(); - clo.setLinkObject(boAndLO.lo); - Map<String,String> cloMap = loService.clo2Map(clo); - Map<String,String> cbo2Map = boService.cbo2Map(cbo); - if(!CollectionUtils.isEmpty(cbo2Map)){ + UIDataTree tree = new UIDataTree(); + BusinessObject cbo = new BusinessObject(); + cbo = boAndLO.bo; + LinkObject clo = new LinkObject(); + clo = boAndLO.lo; + Map<String,Object> cloMap = loService.clo2Map(clo); + Map<String,Object> cbo2Map = boService.cbo2Map(cbo); + + /*if(!CollectionUtils.isEmpty(cbo2Map)){ cbo2Map.forEach((key,value)->{ - cloMap.put(parentFieldName + "." + key,value); + //TODO: 杩欏効涓哄暐瑕佹嫾鎺ヤ笂parentFieldName锛屽鑷村悗闈reemarker琛ㄨ揪寮忔棤娉曟纭浛鎹� + cloMap.put(/*parentFieldName + "." + key,value); }); - } + }*/ tree.setOid(getValueByExpressForBOAndLO(cloMap,cbo2Map,valueField)); tree.setText(getValueByExpressForBOAndLO(cloMap,cbo2Map,textField)); if(StringUtils.isBlank(parentFieldName)){ tree.setParentId(boAndLO.lo.oid + TREE_NODE_ID_SEP + boAndLO.lo.fromOid); }else { if (parentFieldName.contains(".")) { - tree.setParentId(cbo.getAttributeValue(parentFieldName)); + tree.setParentId(ObjectTool.getBOAttributeValue(cbo,parentFieldName)); } else { - tree.setParentId(clo.getAttributeValue(parentFieldName)); + tree.setParentId(ObjectTool.getLOAttributeValue(clo,parentFieldName)); } } - - tree.setAttributes(cbo2Map); + //TODO锛氳繑鍥炵殑鏁版嵁鏀规垚鎸夐摼鎺ョ被鍨嬪拰涓氬姟绫诲瀷涓簁ey锛氬�间负瀵瑰簲鐨勫睘鎬ч泦鍚堝舰寮忚繑鍥� + Map<String, Object> returnMap = new HashMap<>(); + returnMap.put((String) cloMap.get("linktypename"),cloMap); + returnMap.put((String) cbo2Map.get("btmname"),cbo2Map); + tree.setAttributes(returnMap); tree.setIndex(i[0] + ""); i[0]++; tree.setChecked(showCheckBox); @@ -669,7 +767,7 @@ } }); - return Tree.getChildList(rootList,children); + return UIDataTree.getChildList(rootList,children); } /** @@ -678,7 +776,7 @@ * @param fieldExpress 琛ㄨ揪寮忕殑鍊� * @return 杞崲鍚庣殑鍊� */ - private String getValueByExpress(com.vci.client.bof.ClientBusinessObject cbo,String fieldExpress){ + private String getValueByExpress(BusinessObject cbo,String fieldExpress){ if(StringUtils.isBlank(fieldExpress)){ return ""; } @@ -689,7 +787,7 @@ List<String> fieldList = VciBaseUtil.str2List(fieldExpress); StringBuilder sb = new StringBuilder(); fieldList.stream().forEach(field->{ - sb.append(cbo.getAttributeValue(field)).append(" "); + sb.append(ObjectTool.getBOAttributeValue(cbo,field)).append(" "); }); return sb.toString().trim(); } @@ -701,17 +799,30 @@ * @param fieldExpress 琛ㄨ揪寮� * @return 鏇挎崲鍚庣殑鍊� */ - private String getValueByExpressForBOAndLO(Map<String,String> valueMap,Map<String,String> boValueMap,String fieldExpress){ + private String getValueByExpressForBOAndLO(Map<String,Object> valueMap,Map<String,Object> boValueMap,String fieldExpress){ if(fieldExpress.contains("${")){ //浣跨敤freemarker澶勭悊 - return VciBaseUtil.replaceByFreeMarker(fieldExpress,valueMap); + /* + TODO:琛ㄨ揪寮忓瓨鍦═_OID.name杩欑褰㈠紡鏃秄reemarker鏇挎崲瑙勫垯鏄粠T_OID杩欎釜瀵硅薄涓嫑name灞炴�э紝 + 浣嗘槸valueMap鏄竴涓猄tring,String鐨凪ap鎵�浠ラ渶瑕佸皢T_OID.鎴朏_OID.鍘绘帀锛屽洜涓轰笉绠℃槸鏌ヨ鐨� + form绔繕鏄痶o绔兘鏄钩鍙版煡濂芥斁鍦ㄤ笟鍔″睘鎬oValueMap闆嗗悎涓殑锛屾墍浠ョ洿鎺ユ浛灏卞彲浠� + */ + if(fieldExpress.contains(".")){ + //鍘婚櫎t_oid銆乀_OID浠ュ強f_oid銆丗_OID + fieldExpress = fieldExpress + .replace("t_oid.","") + .replace("T_OID.","") + .replace("f_oid.","") + .replace("F_OID.",""); + } + return VciBaseUtil.replaceByFreeMarker(fieldExpress,boValueMap); }else { List<String> fieldList = VciBaseUtil.str2List(fieldExpress); - Map<String,String> valueLowMap = new HashMap<>(); + Map<String,Object> valueLowMap = new HashMap<>(); valueMap.forEach((key,value)->{ valueLowMap.put(key.toLowerCase(),value); }); - Map<String,String> boLowValueMap = new HashMap<>(); + Map<String,Object> boLowValueMap = new HashMap<>(); if(!CollectionUtils.isEmpty(boValueMap)){ boValueMap.forEach((key,value)->{ boLowValueMap.put(key.toLowerCase(),value); @@ -719,7 +830,7 @@ } StringBuilder sb = new StringBuilder(); fieldList.stream().forEach(field->{ - sb.append(valueLowMap.getOrDefault(field,boLowValueMap.getOrDefault(field,""))).append(" "); + sb.append(boLowValueMap.getOrDefault(field,valueLowMap.getOrDefault(field,""))).append(" "); }); return sb.toString().trim(); } @@ -763,11 +874,11 @@ * @throws VciBaseException 閰嶇疆鎴栬�呮槸璋冪敤涓嶆垚鍔熺殑鏃跺�欙紝浼氭姏鍑哄紓甯� */ @Override - public BaseResult callPreEvent(BaseModelDTOList baseModelDTOList,BaseLinkModelDTOList baseLinkModelDTOList, String preEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException{ + public BaseResult callPreEvent(BaseModelDTOList baseModelDTOList, BaseLinkModelDTOList baseLinkModelDTOList, String preEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException{ if((baseModelDTOList == null || CollectionUtils.isEmpty(baseModelDTOList.getDataList())) && (baseLinkModelDTOList == null || CollectionUtils.isEmpty(baseLinkModelDTOList.getDataList()))){ return BaseResult.success(); } - String btmType = (baseModelDTOList !=null && !CollectionUtils.isEmpty(baseModelDTOList.getDataList()))? baseModelDTOList.getDataList().get(0).getBtmname():null; + String btmType = (baseModelDTOList !=null && !CollectionUtils.isEmpty(baseModelDTOList.getDataList()))? baseModelDTOList.getDataList().get(0).getBtmName():null; String linkType = (baseLinkModelDTOList !=null && !CollectionUtils.isEmpty(baseLinkModelDTOList.getDataList()))?baseLinkModelDTOList.getDataList().get(0).getLinkType():null; if(StringUtils.isNotBlank(preEvent)){ //鍓嶇疆浜嬩欢 @@ -870,12 +981,12 @@ * @throws VciBaseException 鎵ц鍑洪敊鐨勪細鎶涘嚭寮傚父锛屾垨鑰呬簨浠剁洿鎺ヨ繑鍥炰簡寮傚父 */ @Override - public BaseResult callPostEvent(Collection<com.vci.client.bof.ClientBusinessObject> cbos, Collection<com.vci.client.bof.ClientLinkObject> clos, String postEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException{ + public BaseResult callPostEvent(Collection<BusinessObject> cbos, Collection<LinkObject> clos, String postEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException{ if(CollectionUtils.isEmpty(cbos)){ return BaseResult.success(); } - String btmType = !CollectionUtils.isEmpty(cbos)?cbos.stream().findFirst().get().getBtmName():null; - String linkType = !CollectionUtils.isEmpty(clos)?clos.stream().findFirst().get().getLinkObject().ltName:null; + String btmType = !CollectionUtils.isEmpty(cbos)?cbos.stream().findFirst().get().btName:null; + String linkType = !CollectionUtils.isEmpty(clos)?clos.stream().findFirst().get().ltName:null; if(StringUtils.isNotBlank(postEvent)){ //鍓嶇疆浜嬩欢 //bean鐨勫悕瀛�#鏂规硶; 鎴栬�呭叏璺緞銆傛渶鍚庝竴涓槸鏂规硶鐨勫悕瀛� @@ -977,7 +1088,7 @@ public BaseModelDTOList formData2DTOList(FormDataDTO formDataDTO){ BaseModelDTOList modelDTOList = new BaseModelDTOList(); BaseModelDTO modelDTO = new BaseModelDTO(); - BeanUtil.convert((BaseModelDTO)formDataDTO,modelDTO); + BeanUtilForVCI.convert(formDataDTO,modelDTO); modelDTO.setData(formDataDTO.getData()); List<BaseModelDTO> modelDTOS = new ArrayList<>(); modelDTOS.add(modelDTO); @@ -995,7 +1106,7 @@ BaseLinkModelDTOList modelDTOList = new BaseLinkModelDTOList(); BaseLinkModelDTO modelDTO = new BaseLinkModelDTO(); modelDTO.setData(formLinkDataDTO.getData()); - BeanUtil.convert((BaseLinkModelDTO)formLinkDataDTO,modelDTO); + BeanUtilForVCI.convert(formLinkDataDTO,modelDTO); List<BaseLinkModelDTO> linkModelDTOS = new ArrayList<>(); linkModelDTOS.add(modelDTO); modelDTOList.setDataList(linkModelDTOS); @@ -1014,7 +1125,7 @@ modelDTOS.stream().findAny().orElseGet(()->null); formDataDTOList.getFormDataDTOS().forEach(formDataDTO -> { BaseModelDTO modelDTO = new BaseModelDTO(); - BeanUtil.convert((BaseModelDTO)formDataDTO,modelDTO); + BeanUtilForVCI.convert((BaseModelDTO)formDataDTO,modelDTO); modelDTO.setData(formDataDTO.getData()); modelDTOS.add(modelDTO); }); @@ -1033,7 +1144,7 @@ List<BaseLinkModelDTO> modelDTOS = new ArrayList<>(); formLinkDataDTOList.getDataDTOList().forEach(formDataDTO -> { BaseLinkModelDTO modelDTO = new BaseLinkModelDTO(); - BeanUtil.convert((BaseLinkModelDTO)formDataDTO,modelDTO); + BeanUtilForVCI.convert((BaseLinkModelDTO)formDataDTO,modelDTO); modelDTO.setData(formDataDTO.getData()); modelDTOS.add(modelDTO); }); @@ -1049,10 +1160,10 @@ * @throws VciBaseException 淇濆瓨鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public BaseResult<Map<String, Object>> addSave(FormDataDTO formDataDTO) throws VciBaseException { + public BaseResult<Map<String, Object>> addSave(FormDataDTO formDataDTO) throws VciBaseException, PLException { //棣栧厛鍒ゆ柇瀵硅薄鏄惁涓虹┖ - VciBaseUtil.alertNotNull(formDataDTO,"娣诲姞鐨勬暟鎹璞�",formDataDTO.getBtmname(),"涓氬姟绫诲瀷鐨勫悕绉�",formDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�"); - UIFormDefineVO formDefineVO = uiEngineService.getFormById(formDataDTO.getBtmname(), formDataDTO.getFormDefineId()); + VciBaseUtil.alertNotNull(formDataDTO,"娣诲姞鐨勬暟鎹璞�",formDataDTO.getBtmName(),"涓氬姟绫诲瀷鐨勫悕绉�",formDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�"); + UIFormDefineVO formDefineVO = uiEngineService.getFormById(formDataDTO.getBtmName(), formDataDTO.getFormDefineId()); String preEvent = formDataDTO.getPreEvent(); BaseModelDTOList modelDTOList = formData2DTOList(formDataDTO); BaseResult beforeResult = callPreEvent(modelDTOList, null,preEvent, VciChangeDocumentTypeEnum.ADD); @@ -1061,35 +1172,32 @@ return beforeResult; } //灏佽鏁版嵁 - BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,false,false); + BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,false,false); if(!resultCbo.isSuccess()){ return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs()); } //鎵ц淇濆瓨 BaseResult<Map<String,Object>> result = BaseResult.success(); - com.vci.client.bof.ClientBusinessObject afterCBO = null; + BusinessObject afterCBO = null; try { -// BusinessObject resultBO = platformClientUtil.getBOFactoryService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false); -// BusinessObject resultBO = ServiceProvider.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false); - BusinessObject resultBO = ClientServiceProvider.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false); - afterCBO = new com.vci.client.bof.ClientBusinessObject(); - afterCBO.setBusinessObject(resultBO); + BusinessObject resultBO = platformClientUtil.getBOFService().createBusinessObject(resultCbo.getObj(),false,false); + afterCBO = new BusinessObject(); + afterCBO = resultBO; result.setObj(boService.cbo2Map(afterCBO)); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } if(!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())){ - fileObjectService.releasedFile(afterCBO.getBtmName(),afterCBO.getOid(),formDataDTO.getReleaseFileOids()); + fileObjectService.releasedFile(afterCBO.btName,afterCBO.oid,formDataDTO.getReleaseFileOids()); } //鍚庣疆浜嬩欢 String afterEvent = formDataDTO.getPostEvent(); try { - callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{afterCBO}).collect(Collectors.toList()),null, afterEvent, VciChangeDocumentTypeEnum.ADD); + callPostEvent(Arrays.stream(new BusinessObject[]{afterCBO}).collect(Collectors.toList()),null, afterEvent, VciChangeDocumentTypeEnum.ADD); }catch (Throwable e){ //璇存槑鍚庣疆浜嬩欢鍑虹幇浜嗛敊璇紝閭d箞灏遍渶瑕佸垹闄や互鍓嶇殑杩欐潯鏁版嵁 try { -// platformClientUtil.getBOFactoryService().deleteBusinessObject(afterCBO.getBusinessObject(),1); - ClientServiceProvider.getBOFService().deleteBusinessObject(afterCBO.getBusinessObject(),1); + platformClientUtil.getBOFService().deleteBusinessObject(afterCBO,1); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1108,7 +1216,7 @@ * @param newVersion 鏂扮増娆� * @return 鎵ц鐨勭粨鏋� */ - private BaseResult<com.vci.client.bof.ClientBusinessObject> wrapperCbo(FormDataDTO formDataDTO,UIFormDefineVO formDefineVO,boolean editFlag,boolean newRevision,boolean newVersion){ + private BaseResult<BusinessObject> wrapperCbo(FormDataDTO formDataDTO,UIFormDefineVO formDefineVO,boolean editFlag,boolean newRevision,boolean newVersion) throws PLException { //鎵╁睍灞炴�х殑鍊� Map<String, String> data = formDataDTO.getData(); Map<String,String> dataLow = new HashMap<>(); @@ -1136,7 +1244,7 @@ Map<String,String> baseDataMap = formDataDTO2MapLow(formDataDTO); Map<String,String> allDataMapLow = new HashMap<>(); allDataMapLow.putAll(dataLow); -// allDataMapLow.putAll(baseDataMap); + allDataMapLow.putAll(baseDataMap); //鍒ゆ柇蹇呰緭椤� BaseResult result = checkRequired(formDefineVO,null,allDataMapLow); if(!result.isSuccess()){ @@ -1149,7 +1257,7 @@ if(!result.isSuccess()){ return result; } - com.vci.client.bof.ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,newRevision,newVersion); + BusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,newRevision,newVersion); return BaseResult.success(cbo); } @@ -1159,41 +1267,41 @@ * @return 鍩虹瀵硅薄 */ @Override - public BaseModel cbo2BaseModel(com.vci.client.bof.ClientBusinessObject cbo){ + public BaseModel cbo2BaseModel(BusinessObject cbo){ BaseModel baseModel = new BaseModel(); - baseModel.setOid(cbo.getOid()); - baseModel.setNameOid(cbo.getNameoid()); - baseModel.setRevisionOid(cbo.getRevisionid()); - baseModel.setBtmname(cbo.getBtmName()); - baseModel.setLastR(String.valueOf(cbo.getIsLastR())); - baseModel.setLastV(String.valueOf(cbo.getIsLastV())); - baseModel.setFirstR(String.valueOf(cbo.getIsFirstR())); - baseModel.setFirstV(String.valueOf(cbo.getIsFirstV())); - baseModel.setCreator(cbo.getCreator()); + baseModel.setOid(cbo.oid); + baseModel.setNameOid(cbo.nameoid); + baseModel.setRevisionOid(cbo.revisionid); + baseModel.setBtmName(cbo.btName); + baseModel.setLastR(String.valueOf(cbo.isLastR)); + baseModel.setLastV(String.valueOf(cbo.isLastV)); + baseModel.setFirstR(String.valueOf(cbo.isFirstR)); + baseModel.setFirstV(String.valueOf(cbo.isFirstV)); + baseModel.setCreator(cbo.creator); try { - baseModel.setCreateTime(new Date(cbo.getCreateTime())); - baseModel.setLastModifyTime(new Date(cbo.getLastModifyTime())); - baseModel.setTs(new Date(cbo.getTs())); + baseModel.setCreateTime(new Date(cbo.createTime)); + baseModel.setLastModifyTime(new Date(cbo.modifyTime)); + baseModel.setTs(new Date(cbo.ts)); // baseModel.setCheckInTime(VciDateUtil.str2Date(cbo.getCheckinTime(), VciDateUtil.DateTimeFormat)); // baseModel.setCheckOutTime(VciDateUtil.str2Date(cbo.getCheckoutTime(), VciDateUtil.DateTimeFormat)); }catch (Throwable e){ } - baseModel.setLastModifier(cbo.getLastModifier()); - baseModel.setRevisionRule(cbo.getRevisionRule()); - baseModel.setVersionRule(cbo.getVersionRule()); - baseModel.setRevisionSeq(cbo.getRevisionSeq()); - baseModel.setRevisionValue(cbo.getRevisionValue()); - baseModel.setVersionSeq(cbo.getVersionSeq()); - baseModel.setVersionValue(cbo.getVersionValue()); - baseModel.setLcStatus(cbo.getLcStatus()); - baseModel.setId(cbo.getId()); - baseModel.setName(cbo.getName()); - baseModel.setDescription(cbo.getDescription()); - baseModel.setOwner(cbo.getOwner()); + baseModel.setLastModifier(cbo.modifier); + baseModel.setRevisionRule(cbo.revisionRule); + baseModel.setVersionRule(cbo.versionRule); + baseModel.setRevisionSeq(cbo.revisionSeq); + baseModel.setRevisionValue(cbo.revisionValue); + baseModel.setVersionSeq(cbo.versionSeq); + baseModel.setVersionValue(cbo.versionValue); + baseModel.setLcStatus(cbo.lcStatus); + baseModel.setId(cbo.id); + baseModel.setName(cbo.name); + baseModel.setDescription(cbo.description); + baseModel.setOwner(cbo.owner); // baseModel.setCheckInBy(cbo.getCheckinBy()); // baseModel.setCheckOutBy(cbo.getCheckoutBy()); - baseModel.setCopyFromVersion(cbo.getCopyFromVersion()); + baseModel.setCopyFromVersion(cbo.fromVersion); return baseModel; } @@ -1241,12 +1349,12 @@ * @return 鐗堟湰鐨勫璞� */ @Override - public RevisionValueObject getNextRevision(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ + public RevisionDataInfo getNextRevision(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ try { if(baseModel.getRevisionValue() == null){ baseModel.setRevisionValue(""); } - return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextRevisionValueObject(WebUtil.getTableName(btmTypeVO.getId()),baseModel.getNameOid(),btmTypeVO.getRevisionRuleId(),btmTypeVO.isInputRevisionFlag(),baseModel.getRevisionValue())); + return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextRevisionValueObject(btmTypeVO.getId(),baseModel.getNameOid(),btmTypeVO.getRevisionRuleId(),btmTypeVO.isInputRevisionFlag(),baseModel.getRevisionValue())); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1257,10 +1365,10 @@ * @param info corba瀵硅薄 * @return java瀵硅薄 */ - private RevisionValueObject changeRevisionValueInfoToObject(RevisionDataInfo info) { - RevisionValueObject object = new RevisionValueObject(); - object.setRevisionVal(info.revisionVal); - object.setRevisionSeq(info.revisionSeq); + private RevisionDataInfo changeRevisionValueInfoToObject(RevisionDataInfo info) { + RevisionDataInfo object = new RevisionDataInfo(); + object.revisionVal = info.revisionVal; + object.revisionSeq = info.revisionSeq; return object; } @@ -1271,7 +1379,7 @@ * @return 鐗堟湰鐨勫�煎璞� */ @Override - public VersionValueObject getNextVersion(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ + public VersionDataInfo getNextVersion(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ try{ return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextVersionValue(WebUtil.getTableName(btmTypeVO.getId()),baseModel.getRevisionOid(),baseModel.getNameOid(),WebUtil.getInt(btmTypeVO.getVersionRule()))); }catch (PLException vciError){ @@ -1284,10 +1392,10 @@ * @param info 鐗堟鐨勫�� * @return java瀵硅薄 */ - private VersionValueObject changeRevisionValueInfoToObject(VersionDataInfo info) { - VersionValueObject object = new VersionValueObject(); - object.setVersionVal(info.versionVal); - object.setVersionSeq(info.versionSeq); + private VersionDataInfo changeRevisionValueInfoToObject(VersionDataInfo info) { + VersionDataInfo object = new VersionDataInfo(); + object.versionVal = info.versionVal; + object.versionSeq = info.versionSeq; return object; } /** @@ -1317,11 +1425,11 @@ * @throws VciBaseException 淇濆瓨鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public BaseResult<String> batchAddSave(FormDataDTOList formDataDTOList) throws VciBaseException { + public BaseResult<String> batchAddSave(FormDataDTOList formDataDTOList) throws VciBaseException, PLException { VciBaseUtil.alertNotNull(formDataDTOList,"瑕佹坊鍔犵殑鏁版嵁",formDataDTOList.getFormDataDTOS(),"瑕佹坊鍔犵殑鏁版嵁"); //棣栧厛鍒ゆ柇瀵硅薄鏄惁涓虹┖ FormDataDTO firstFormDataDTO = formDataDTOList.getFormDataDTOS().stream().findFirst().get(); - UIFormDefineVO formDefineVO = uiEngineService.getFormById(firstFormDataDTO.getBtmname(), firstFormDataDTO.getId()); + UIFormDefineVO formDefineVO = uiEngineService.getFormById(firstFormDataDTO.getBtmName(), firstFormDataDTO.getId()); String preEvent = firstFormDataDTO.getPreEvent(); BaseModelDTOList modelDTOList = formDataList2DTOList(formDataDTOList); BaseResult beforeResult = callPreEvent(modelDTOList, null, preEvent, VciChangeDocumentTypeEnum.ADD); @@ -1332,26 +1440,25 @@ //灏佽鏁版嵁 List<BusinessObject> addBos = new ArrayList<>(); List<BusinessObject> afterBOs = new ArrayList<>(); - List<com.vci.client.bof.ClientBusinessObject> afterCBOs = new ArrayList<>(); + List<BusinessObject> afterCBOs = new ArrayList<>(); Map<String,List<String>> releasedFileOids = new HashMap<>(); for(FormDataDTO formDataDTO:formDataDTOList.getFormDataDTOS()) { - BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, false, false, false); + BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, false, false, false); if (!resultCbo.isSuccess()) { return BaseResult.fail(resultCbo.getMsg(), resultCbo.getMsgObjs()); } - addBos.add(resultCbo.getObj().getBusinessObject()); + addBos.add(resultCbo.getObj()); //鎵ц淇濆瓨 if (!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())) { - releasedFileOids.put(resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); + releasedFileOids.put(resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); } } try { -// BusinessObject[] resultBOs = platformClientUtil.getBOFactoryService().batchCreateBusinessObject(addBos.toArray(new BusinessObject[0]), false, false); - BusinessObject[] resultBOs = ClientServiceProvider.getBOFService().batchCreateBusinessObject(addBos.toArray(new BusinessObject[0]), false, false); + BusinessObject[] resultBOs = platformClientUtil.getBOFService().batchCreateBusinessObject(addBos.toArray(new BusinessObject[0]), false, false); afterBOs = Arrays.stream(resultBOs).collect(Collectors.toList()); Arrays.stream(resultBOs).forEach(bo->{ - com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); - cbo.setBusinessObject(bo); + BusinessObject cbo = new BusinessObject(); + cbo = bo; afterCBOs.add(cbo); }); } catch (PLException vciError) { @@ -1359,7 +1466,7 @@ } if(!CollectionUtils.isEmpty(releasedFileOids)){ releasedFileOids.forEach((oid,fileOids)->{ - fileObjectService.releasedFile(firstFormDataDTO.getBtmname(),oid,fileOids); + fileObjectService.releasedFile(firstFormDataDTO.getBtmName(),oid,fileOids); }); } //鍚庣疆浜嬩欢 @@ -1369,7 +1476,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); } @@ -1388,10 +1495,10 @@ * @throws VciBaseException 淇濆瓨鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public BaseResult<Map<String, Object>> editSave(FormDataDTO formDataDTO) throws VciBaseException { + public BaseResult<Map<String, Object>> editSave(FormDataDTO formDataDTO) throws VciBaseException, PLException { //棣栧厛鍒ゆ柇瀵硅薄鏄惁涓虹┖ - VciBaseUtil.alertNotNull(formDataDTO,"淇敼鐨勬暟鎹璞�",formDataDTO.getBtmname(),"涓氬姟绫诲瀷鐨勫悕绉�",formDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�"); - UIFormDefineVO formDefineVO = uiEngineService.getFormById(formDataDTO.getBtmname(), formDataDTO.getFormDefineId()); + VciBaseUtil.alertNotNull(formDataDTO,"淇敼鐨勬暟鎹璞�",formDataDTO.getBtmName(),"涓氬姟绫诲瀷鐨勫悕绉�",formDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�"); + UIFormDefineVO formDefineVO = uiEngineService.getFormById(formDataDTO.getBtmName(), formDataDTO.getFormDefineId()); String preEvent = formDataDTO.getPreEvent(); BaseModelDTOList modelDTOList = formData2DTOList(formDataDTO); BaseResult beforeResult = callPreEvent(modelDTOList,null, preEvent, VciChangeDocumentTypeEnum.EDIT); @@ -1400,26 +1507,25 @@ return beforeResult; } //灏佽鏁版嵁 - BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,true,false,false); + BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,true,false,false); if(!resultCbo.isSuccess()){ return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs()); } //鎵ц淇濆瓨 BaseResult<Map<String,Object>> result = BaseResult.success(); try { -// platformClientUtil.getBOFactoryService().updateBusinessObject(new BusinessObjectHolder(resultCbo.getObj().getBusinessObject())); - ClientServiceProvider.getBOFService().updateBusinessObject(resultCbo.getObj().getBusinessObject()); + platformClientUtil.getBOFService().updateBusinessObject(resultCbo.getObj()); result.setObj(boService.cbo2Map(resultCbo.getObj())); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } if(!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())){ - fileObjectService.releasedFile(resultCbo.getObj().getBtmName(),resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); + fileObjectService.releasedFile(resultCbo.getObj().btName,resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); } //鍚庣疆浜嬩欢 String afterEvent = formDataDTO.getPostEvent(); try { - callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); + callPostEvent(Arrays.stream(new BusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); }catch (Throwable e){ throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); } @@ -1434,10 +1540,10 @@ * @throws VciBaseException 淇濆瓨鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public BaseResult<Map<String, Object>> upRevision(FormDataDTO formDataDTO) throws VciBaseException { + public BaseResult<Map<String, Object>> upRevision(FormDataDTO formDataDTO) throws VciBaseException, PLException { //棣栧厛鍒ゆ柇瀵硅薄鏄惁涓虹┖ - VciBaseUtil.alertNotNull(formDataDTO,"淇敼鐨勬暟鎹璞�",formDataDTO.getBtmname(),"涓氬姟绫诲瀷鐨勫悕绉�",formDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�",formDataDTO.getCopyFromVersion(),"鑰佺増鏈殑涓婚敭"); - UIFormDefineVO formDefineVO = uiEngineService.getFormById(formDataDTO.getBtmname(), formDataDTO.getFormDefineId()); + VciBaseUtil.alertNotNull(formDataDTO,"淇敼鐨勬暟鎹璞�",formDataDTO.getBtmName(),"涓氬姟绫诲瀷鐨勫悕绉�",formDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�",formDataDTO.getCopyFromVersion(),"鑰佺増鏈殑涓婚敭"); + UIFormDefineVO formDefineVO = uiEngineService.getFormById(formDataDTO.getBtmName(), formDataDTO.getFormDefineId()); String preEvent = formDataDTO.getPreEvent(); BaseModelDTOList modelDTOList = formData2DTOList(formDataDTO); BaseResult beforeResult = callPreEvent(modelDTOList, null,preEvent, VciChangeDocumentTypeEnum.UPREVISION); @@ -1445,29 +1551,40 @@ //璇存槑鍓嶇疆浜嬩欢娌℃湁鎵ц鎴愬姛 return beforeResult; } - //灏佽鏁版嵁 - BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); - if(!resultCbo.isSuccess()){ - return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs()); + List<BusinessObject> businessObjects = null; + Date ts = formDataDTO.getTs(); + Map<String,String> conditionMap = WebUtil.getOidQuery(formDataDTO.getCopyFromVersion()); + conditionMap.put("ts", VciDateUtil.date2Str(ts,VciDateUtil.DateTimeMillFormat)); + conditionMap.put("oid",formDataDTO.getCopyFromVersion()); + businessObjects = boService.queryCBO(formDataDTO.getBtmName(), conditionMap); + if(businessObjects.size() ==0){ + throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽缓璁偍鍒锋柊鍚庨噸鏂版搷浣�"); } + //鎵╁睍灞炴�х殑鍊� + Map<String, String> data = formDataDTO.getData(); + Map<String,String> dataLow = new HashMap<>(); + data.forEach((key,value)->{ + dataLow.put(key.toLowerCase(),value); + }); + + Map<String,String> baseDataMap = formDataDTO2MapLow(formDataDTO); + Map<String,String> allDataMapLow = new HashMap<>(); + allDataMapLow.putAll(dataLow); + allDataMapLow.putAll(baseDataMap); + //鍒ゆ柇鍞竴椤� + BaseResult baseResult = checkUnique(formDefineVO, null, allDataMapLow, true); + if(!baseResult.isSuccess()){ + return baseResult; + } + BusinessObject businessObject = platformClientUtil.getBOFService() + .revisionBusinessObject(businessObjects.get(0), null, !formDataDTO.isUpVersion(),true, false, false); //鎵ц淇濆瓨 - BaseResult<Map<String,Object>> result = BaseResult.success(); - try { -// BusinessObject bo = platformClientUtil.getBOFactoryService().createBusinessObject(resultCbo.getObj().getBusinessObject(),formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); - BusinessObject bo = ClientServiceProvider.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); - com.vci.client.bof.ClientBusinessObject afterCbo = new com.vci.client.bof.ClientBusinessObject(); - afterCbo.setBusinessObject(bo); - result.setObj(boService.cbo2Map(afterCbo)); - } catch (PLException vciError) { - throw WebUtil.getVciBaseException(vciError); - } - if(!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())){ - fileObjectService.releasedFile(resultCbo.getObj().getBtmName(),resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); - } + BaseResult<Map<String, Object>> result = BaseResult.success(); + result.setObj(boService.cbo2Map(businessObject)); //鍚庣疆浜嬩欢 String afterEvent = formDataDTO.getPostEvent(); try { - callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); + callPostEvent(Arrays.stream(new BusinessObject[]{businessObject}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); }catch (Throwable e){ throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); } @@ -1482,11 +1599,11 @@ * @throws VciBaseException 淇濆瓨鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public BaseResult<String> batchEditSave(FormDataDTOList formDataDTOList) throws VciBaseException { + public BaseResult<String> batchEditSave(FormDataDTOList formDataDTOList) throws VciBaseException, PLException { VciBaseUtil.alertNotNull(formDataDTOList,"瑕佷慨鏀圭殑鏁版嵁",formDataDTOList.getFormDataDTOS(),"瑕佷慨鏀圭殑鏁版嵁"); //棣栧厛鍒ゆ柇瀵硅薄鏄惁涓虹┖ FormDataDTO firstFormDataDTO = formDataDTOList.getFormDataDTOS().stream().findFirst().get(); - UIFormDefineVO formDefineVO = uiEngineService.getFormById(firstFormDataDTO.getBtmname(), firstFormDataDTO.getId()); + UIFormDefineVO formDefineVO = uiEngineService.getFormById(firstFormDataDTO.getBtmName(), firstFormDataDTO.getId()); String preEvent = firstFormDataDTO.getPreEvent(); BaseModelDTOList modelDTOList = formDataList2DTOList(formDataDTOList); BaseResult beforeResult = callPreEvent(modelDTOList,null, preEvent, VciChangeDocumentTypeEnum.EDIT); @@ -1497,16 +1614,16 @@ //灏佽鏁版嵁 List<BusinessObject> updateCBOS = new ArrayList<>(); Map<String,List<String>> releasedFileOids = new HashMap<>(); - List<com.vci.client.bof.ClientBusinessObject> afterCBOs = new ArrayList<>(); + List<BusinessObject> afterCBOs = new ArrayList<>(); for(FormDataDTO formDataDTO:formDataDTOList.getFormDataDTOS()) { - BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, true, false, false); + BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, true, false, false); if (!resultCbo.isSuccess()) { return BaseResult.fail(resultCbo.getMsg(), resultCbo.getMsgObjs()); } - updateCBOS.add(resultCbo.getObj().getBusinessObject()); + updateCBOS.add(resultCbo.getObj()); //鎵ц淇濆瓨 if (!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())) { - releasedFileOids.put(resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); + releasedFileOids.put(resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); } } try { @@ -1516,7 +1633,7 @@ } if(!CollectionUtils.isEmpty(releasedFileOids)){ releasedFileOids.forEach((oid,fileOids)->{ - fileObjectService.releasedFile(firstFormDataDTO.getBtmname(),oid,fileOids); + fileObjectService.releasedFile(firstFormDataDTO.getBtmName(),oid,fileOids); }); } //鍚庣疆浜嬩欢 @@ -1539,15 +1656,15 @@ * @throws VciBaseException 鏁版嵁琚紩鐢ㄧ殑鏃跺�欎細鎶涘嚭寮傚父 */ @Override - public BaseResult batchDelete(DeleteDataDTO deleteDataDTO) throws VciBaseException { + public BaseResult batchDelete(DeleteDataDTO deleteDataDTO) throws VciBaseException, PLException { VciBaseUtil.alertNotNull(deleteDataDTO,"鏁版嵁浼犺緭瀵硅薄",deleteDataDTO.getDataList(),"鏁版嵁浼犺緭瀵硅薄"); - String btmName = deleteDataDTO.getDataList().get(0).getBtmname(); + String btmName = deleteDataDTO.getDataList().get(0).getBtmName(); List<String> oidList = deleteDataDTO.getDataList().stream().map(BaseModelDTO::getOid).collect(Collectors.toList()); //鐪嬬湅绾ц仈鍒犻櫎銆傚彧鏈夎嚜宸卞紩鐢ㄨ嚜宸辩殑鏃跺�欏彲浠ョ骇鑱斿垹闄� - List<com.vci.client.bof.ClientBusinessObject> cbo = null; + List<BusinessObject> cbo = null; if(deleteDataDTO.isCascade()){ //绾ц仈鍒犻櫎 - OsBtmTypeVO btmTypeVO = btmService.getBtmById(btmName); + OsBtmTypeVO btmTypeVO = btmService.getBtmByName(btmName); OsBtmTypeAttributeVO parentAttributeVO = btmTypeVO.getAttributes().stream().filter(s -> s.getReferBtmTypeId().equalsIgnoreCase(btmName)).findFirst().orElseGet(null); if(parentAttributeVO != null){ //椤甸潰鍒嗛〉涓嶈兘鏄剧ず瓒呰繃1000 @@ -1563,8 +1680,8 @@ if(CollectionUtils.isEmpty(cbo)){ return BaseResult.fail("娌℃湁鍦ㄧ郴缁熶腑鎵惧埌杩欎簺鏁版嵁锛屾湭鎵ц鍒犻櫎鎿嶄綔"); } - List<com.vci.client.bof.ClientBusinessObject> finalCbo = cbo; - Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(finalCbo.stream().map(com.vci.client.bof.ClientBusinessObject::getOid).collect(Collectors.toList())); + List<BusinessObject> finalCbo = cbo; + Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(finalCbo.stream().map(bo -> bo.oid).collect(Collectors.toList())); List<OsUsedAttributeVO> usedAttributeVOS = null; boolean adminCascade = false; if("admin".equalsIgnoreCase(VciBaseUtil.getCurrentUserId()) && deleteDataDTO.isAdminCascade()){ @@ -1580,7 +1697,12 @@ conditionMap.put(usedAttributeVO.getId(),QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); if(StringUtils.isNotBlank(usedAttributeVO.getPkBtmType())) { if (boService.queryCount(usedAttributeVO.getPkBtmType(), conditionMap) > 0) { - OsBtmTypeVO btmTypeVO = btmService.getBtmById(usedAttributeVO.getPkBtmType()); + OsBtmTypeVO btmTypeVO = null; + try { + btmTypeVO = btmService.getBtmById(usedAttributeVO.getPkBtmType()); + } catch (PLException e) { + e.printStackTrace(); + } throw new VciBaseException("鏁版嵁鍦ㄣ��" + btmTypeVO.getName() + "銆戜腑鐨勫瓧娈礫" + usedAttributeVO.getName() + "]閲岃寮曠敤.涓嶈兘鍒犻櫎"); } }else{ @@ -1599,7 +1721,7 @@ Map<String,String> conditionMap = new HashMap<>(); conditionMap.put(usedAttributeVO.getId(),QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); if(StringUtils.isNotBlank(usedAttributeVO.getPkBtmType())) { - List<com.vci.client.bof.ClientBusinessObject> tempCbos = boService.queryCBO(usedAttributeVO.getPkBtmType(), conditionMap); + List<BusinessObject> tempCbos = boService.queryCBO(usedAttributeVO.getPkBtmType(), conditionMap); if(!CollectionUtils.isEmpty(tempCbos)){ finalCbo.addAll(tempCbos); } @@ -1612,13 +1734,11 @@ } VciBaseUtil.switchCollectionForOracleIn(finalCbo).stream().forEach(cbos->{ try { -// platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(s->s.getBusinessObject()).collect(Collectors.toList()).toArray(new BusinessObject[0]),1); - ClientServiceProvider.getBOFService().batchDeleteBusinessObject(cbos.stream().map(s->s.getBusinessObject()).collect(Collectors.toList()).toArray(new BusinessObject[0]),1); + platformClientUtil.getBOFService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),1); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } }); - System.out.println("zheshi shazi "); return BaseResult.success(); } @@ -1630,7 +1750,7 @@ * @throws VciBaseException 鍙傛暟涓虹┖锛屽繀杈撻」缂哄け */ @Override - public BaseResult<String> linkAddSave(FormLinkDataDTO formLinkDataDTO) throws VciBaseException { + public BaseResult<String> linkAddSave(FormLinkDataDTO formLinkDataDTO) throws VciBaseException, PLException { //棣栧厛鍒ゆ柇瀵硅薄鏄惁涓虹┖ VciBaseUtil.alertNotNull(formLinkDataDTO,"娣诲姞鐨勬暟鎹璞�",formLinkDataDTO.getLinkType(),"閾炬帴绫诲瀷鐨勫悕绉�",formLinkDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�"); if(formLinkDataDTO.getData() ==null){ @@ -1654,7 +1774,7 @@ //璇存槑鍓嶇疆浜嬩欢娌℃湁鎵ц鎴愬姛 return beforeResult; } - com.vci.client.bof.ClientLinkObject clo = null; + LinkObject clo = null; String prefix = ""; if(formLinkDataDTO.isDirection()){ prefix = LO_FROM_PREFIX; @@ -1681,14 +1801,6 @@ throw new VciBaseException(formLinkDataDTO.isDirection()?"from绔�":"to绔�" + "鐨勪笟鍔$被鍨嬩负绌�"); } - //鏌ヨfrom绔殑 - com.vci.client.bof.ClientBusinessObject fromCbo = new com.vci.client.bof.ClientBusinessObject(); - try { -// fromCbo.setBusinessObject(platformClientUtil.getBOFactoryService().readBusinessObject(fromOid,fromBtmName)); - fromCbo.setBusinessObject(ClientServiceProvider.getBOFService().readBusinessObject(fromOid,fromBtmName)); - } catch (PLException vciError) { - throw WebUtil.getVciBaseException(vciError); - } String finalPrefix = prefix; formLinkDataDTO.getData().forEach((key, value)->{ if(key.toLowerCase().startsWith(finalPrefix)){ @@ -1698,55 +1810,47 @@ } }); //灏佽to绔殑 - BaseResult<com.vci.client.bof.ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO,formDefineVO,toOid,toBtmName,boData); + BaseResult<BusinessObject> result = wrapperToCbo(formLinkDataDTO,formDefineVO,toOid,toBtmName,boData); if(!result.isSuccess()){ return BaseResult.fail(result.getMsg(),result.getMsgObjs()); } - com.vci.client.bof.ClientBusinessObject toCbo = result.getObj(); + BusinessObject toCbo = result.getObj(); //鍒濆鍖栭摼鎺ョ被鍨嬬殑鍊� - BaseResult<com.vci.client.bof.ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, false); + BaseResult<LinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, false); if(!resultClo.isSuccess()){ return BaseResult.fail(resultClo.getMsg(),resultClo.getMsgObjs()); } clo = resultClo.getObj(); - if(formLinkDataDTO.isDirection()){ - clo.setFromBO(toCbo); - clo.setToBO(fromCbo); - } else { - clo.setFromBO(fromCbo); - clo.setToBO(toCbo); + if(StringUtils.isBlank(clo.toOid)){ + clo.toOid = toCbo.oid; } //鎵ц淇濆瓨 BusinessObject[] bos = new BusinessObject[1]; - toCbo.dealBusinessObjectNullValue(); - clo.dealLinkObjectNullValue(); - bos[0] = toCbo.getBusinessObject(); + ObjectTool.dealBusinessObjectNullValue(toCbo); + bos[0] = toCbo; try { -// platformClientUtil.getBOFactoryService().createBusinessObjectWithLink(bosHolder,loHolder); - ClientServiceProvider.getBOFService().createBusinessObjectWithLink(bos,clo.getLinkObject()); + platformClientUtil.getBOFService().createBusinessObjectWithLink(bos,clo); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } if(!CollectionUtils.isEmpty(formLinkDataDTO.getReleaseFileOids())){ - fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.getOid(),formLinkDataDTO.getReleaseFileOids()); + fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.oid,formLinkDataDTO.getReleaseFileOids()); } //鍚庣疆浜嬩欢 String afterEvent = formLinkDataDTO.getPostEvent(); try { - callPostEvent(null,Arrays.stream(new com.vci.client.bof.ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); + callPostEvent(null,Arrays.stream(new LinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); }catch (Throwable e){ //璇存槑鍚庣疆浜嬩欢鍑虹幇浜嗛敊璇紝閭d箞灏遍渶瑕佸垹闄や互鍓嶇殑杩欐潯鏁版嵁 try { -// platformClientUtil.getBOFactoryService().deleteBusinessObject(toCbo.getBusinessObject(),1); -// platformClientUtil.getBOFactoryService().deleteLinkObject(clo.getLinkObject()); - ClientServiceProvider.getBOFService().deleteBusinessObject(toCbo.getBusinessObject(),1); - ClientServiceProvider.getBOFService().deleteLinkObject(clo.getLinkObject()); + platformClientUtil.getBOFService().deleteBusinessObject(toCbo,1); + platformClientUtil.getBOFService().deleteLinkObject(clo); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); } - return BaseResult.success(clo.getOid()); + return BaseResult.success(clo.oid); } /** @@ -1757,7 +1861,7 @@ * @param editFlag 鏄惁涓虹紪杈� * @return 閾炬帴绫诲瀷鐨勫唴瀹� */ - private BaseResult<com.vci.client.bof.ClientLinkObject> wrapperOnlyCLO(FormLinkDataDTO formLinkDataDTO,Map<String,String> loData,UIFormDefineVO formDefineVO,boolean editFlag){ + private BaseResult<LinkObject> wrapperOnlyCLO(FormLinkDataDTO formLinkDataDTO,Map<String,String> loData,UIFormDefineVO formDefineVO,boolean editFlag){ Map<String,String> baseDataMap = formLinkDataDTO2MapLow(formLinkDataDTO); Map<String,String> allDataMap = new HashMap<>(); allDataMap.putAll(loData); @@ -1773,33 +1877,40 @@ return result; } //澶勭悊涓氬姟绫诲瀷寰楀埌鏁版嵁 - ClientLinkObject clo ; + LinkObject clo ; if(editFlag){ try { -// LinkObject linkObject = platformClientUtil.getBOFactoryService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType()); - LinkObject linkObject = ClientServiceProvider.getBOFService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType()); - clo = new ClientLinkObject(); - clo.setLinkObject(linkObject); + LinkObject linkObject = platformClientUtil.getBOFService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType()); + clo = linkObject; } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } }else{ - clo = new ClientLinkObject(); + clo = new LinkObject(); //澶勭悊鍒濆鍖栫殑鏁版嵁 - clo.setOid(VciBaseUtil.getPk()); - clo.setCreator(VciBaseUtil.getCurrentUserId()); - clo.setCreateTime(System.currentTimeMillis()); - clo.setTs(System.currentTimeMillis()); - clo.setLoName(formLinkDataDTO.getLinkType()); + clo.oid = VciBaseUtil.getPk(); + clo.creator = VciBaseUtil.getCurrentUserId(); + 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(); } // - allDataMap.forEach((key,value)->{ + LinkObject finalClo = clo; + allDataMap.forEach((key, value)->{ if(editFlag&&("lastmodifier".equalsIgnoreCase(key) || "lastmodifytime".equalsIgnoreCase(key) || "ts".equalsIgnoreCase(key) || "creator".equalsIgnoreCase(key) || "createtime".equalsIgnoreCase(key))){ //骞冲彴涓嶈兘浼犻�掕繖涓� }else{ - loService.setAttribute(clo,key,value); + loService.setAttribute(finalClo,key,value); } }); return BaseResult.success(clo); @@ -1815,7 +1926,7 @@ * @param boData to鐨勬暟鎹� * @return 鍖呭惈鐨勫璞� */ - private BaseResult<com.vci.client.bof.ClientBusinessObject> wrapperToCbo(FormLinkDataDTO formLinkDataDTO,UIFormDefineVO formDefineVO,String toOid,String toBtmName,Map<String,String> boData){ + private BaseResult<BusinessObject> wrapperToCbo(FormLinkDataDTO formLinkDataDTO,UIFormDefineVO formDefineVO,String toOid,String toBtmName,Map<String,String> boData) throws PLException { Map<String,String> dataLow = new HashMap<>(); boData.forEach((key,value)->{ dataLow.put(key.toLowerCase(),value); @@ -1842,7 +1953,7 @@ if(!result.isSuccess()){ return result; } - com.vci.client.bof.ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,formLinkDataDTO.isToUpRevision(),formLinkDataDTO.isToUpVersion()); + BusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,formLinkDataDTO.isToUpRevision(),formLinkDataDTO.isToUpVersion()); return BaseResult.success(cbo); } @@ -1935,141 +2046,140 @@ * @param newVersion 鏄惁鍗囩増娆� * @return cbo瀵硅薄 */ - public com.vci.client.bof.ClientBusinessObject createOrGetCbo(Map<String,String> dataLowMap,Map<String,String> baseDataMap,boolean editFlag,boolean newRevision,boolean newVersion){ + public BusinessObject createOrGetCbo(Map<String,String> dataLowMap,Map<String,String> baseDataMap,boolean editFlag,boolean newRevision,boolean newVersion) throws PLException { String btmName = baseDataMap.get("btmname"); String oid = baseDataMap.get("oid"); -// ClientBusinessObject cbo = new ClientBusinessObject(); - ClientBusinessObject cbo = new ClientBusinessObject(); +// BusinessObject cbo = new BusinessObject(); + BusinessObject cbo = new BusinessObject(); String copyfromversion = baseDataMap.get("copyfromversion"); - OsBtmTypeVO btmTypeVO = btmService.getBtmById(btmName); - List<String> attributeList = btmTypeVO.getAttributes().stream().map(attribute -> attribute.getId()).collect(Collectors.toList()); + //OsBtmTypeVO btmTypeVO = btmService.getBtmById(btmName); + OsBtmTypeVO btmTypeVO = btmService.getBtmByName(btmName); + //List<String> attributeList = btmTypeVO.getAttributes().stream().map(attribute -> attribute.getId()).collect(Collectors.toList()); if(editFlag || newRevision || newVersion){ try { -// cbo.setBusinessObject(platformClientUtil.getBOFactoryService().readBusinessObject(editFlag?oid:copyfromversion,btmName)); - cbo.setBusinessObject(ClientServiceProvider.getBOFService().readBusinessObject(editFlag?oid:copyfromversion,btmName)); + cbo = platformClientUtil.getBOFService().readBusinessObject(editFlag?oid:copyfromversion,btmName); } catch (PLException vciError) { throw new VciBaseException("浣跨敤涓婚敭鍦ㄧ郴缁熶腑娌℃湁鏌ヨ鍒版暟鎹�",new String[]{oid},vciError); } if(btmTypeVO.isRevisionFlag() && newRevision){ - cbo.setOid(VciBaseUtil.getPk()); - cbo.setCopyFromVersion(copyfromversion); + cbo.oid = VciBaseUtil.getPk(); + cbo.fromVersion = copyfromversion; if(btmTypeVO.isInputRevisionFlag() && StringUtils.isNotBlank(baseDataMap.getOrDefault("revisionvalue",""))){ //鎵嬪姩鐨勶紝鎵�浠ヤ笉澶勭悊鐗堟湰瑙勫垯浜� - cbo.setRevisionValue(baseDataMap.get("revisionvalue")); + cbo.revisionValue = baseDataMap.get("revisionvalue"); }else{ //璇存槑鏄崌鐗� BaseModel baseModel = cbo2BaseModel(cbo); - RevisionValueObject revisionValueObject = getNextRevision(btmTypeVO,baseModel); - cbo.setRevisionid(VciBaseUtil.getPk()); - cbo.setRevisionSeq((short) revisionValueObject.getRevisionSeq()); - cbo.setRevisionValue(revisionValueObject.getRevisionVal()); - cbo.setIsLastR(true); - cbo.setIsFirstR(false); + RevisionDataInfo revisionValueObject = getNextRevision(btmTypeVO,baseModel); + cbo.revisionid = VciBaseUtil.getPk(); + cbo.revisionSeq = revisionValueObject.revisionSeq; + cbo.revisionValue = revisionValueObject.revisionVal; + cbo.isLastR = true; + cbo.isFirstR = false; //澶勭悊鐗堟 - cbo.setVersionValue(getFirstVersion(btmTypeVO.getVersionRule())); - cbo.setVersionRule(btmTypeVO.getVersionRule()); - cbo.setVersionSeq((short) 0); - cbo.setIsLastV(true); - cbo.setIsFirstV(true); + cbo.versionValue = getFirstVersion(btmTypeVO.getVersionRule()); + cbo.versionRule = btmTypeVO.getVersionRule(); + cbo.versionSeq = (short) 0; + cbo.isLastV = true; + cbo.isFirstV = true; } //鍗囩増鐨勬椂鍊欙紝鐢熷懡鍛ㄦ湡鐨勭姸鎬侀渶瑕佹敼鍔ㄥ埌榛樿鐘舵�� if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ //鏌ヨ鐢熷懡鍛ㄦ湡 -// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId()); LifeCycle lifeCycleVO = null; try { - lifeCycleVO = ClientServiceProvider.getOMDService().getLifeCycleService().getLifeCycle(btmTypeVO.getLifeCycleId()); + lifeCycleVO = platformClientUtil.getLifeCycleService().getLifeCycle(btmTypeVO.getLifeCycleId()); } catch (PLException e) { throw new RuntimeException(e); } if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.oid)){ throw new VciBaseException("{0}閲岀殑鐢熷懡鍛ㄦ湡璁剧疆寰椾笉姝g‘锛屽湪绯荤粺涓病鏈夋壘鍒皗1}杩欎釜鐢熷懡鍛ㄦ湡",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()}); } - cbo.setLcStatus(lifeCycleVO.startState); + cbo.lcStatus = lifeCycleVO.startState; } } if(btmTypeVO.isRevisionFlag() && newVersion){ - cbo.setCopyFromVersion(copyfromversion); - cbo.setOid(VciBaseUtil.getPk()); + cbo.fromVersion = copyfromversion; + cbo.oid = VciBaseUtil.getPk(); //杩欐槸鍗囩増娆★紝涓嶅瓨鍦ㄥ嵆鍗囩増鏈紝鍙堝崌鐗堟鐨勬儏鍐� BaseModel baseModel = cbo2BaseModel(cbo); - VersionValueObject versionValueObject = getNextVersion(btmTypeVO,baseModel); - cbo.setVersionValue(versionValueObject.getVersionVal()); - cbo.setVersionSeq((short) versionValueObject.getVersionSeq()); - cbo.setIsLastV(true); - cbo.setIsFirstV(false); + VersionDataInfo versionValueObject = getNextVersion(btmTypeVO,baseModel); + cbo.versionValue = versionValueObject.versionVal; + cbo.versionSeq = versionValueObject.versionSeq; + cbo.isLastV = true; + cbo.isFirstV = false; //鍗囩増鐨勬椂鍊欙紝鐢熷懡鍛ㄦ湡鐨勭姸鎬侀渶瑕佹敼鍔ㄥ埌榛樿鐘舵�� if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ //鏌ヨ鐢熷懡鍛ㄦ湡 -// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId()); LifeCycle lifeCycleVO = null; try { - lifeCycleVO = ClientServiceProvider.getOMDService().getLifeCycleService().getLifeCycle(btmTypeVO.getLifeCycleId()); + lifeCycleVO = platformClientUtil.getLifeCycleService().getLifeCycle(btmTypeVO.getLifeCycleId()); } catch (PLException e) { throw new RuntimeException(e); } if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.oid)){ throw new VciBaseException("{0}閲岀殑鐢熷懡鍛ㄦ湡璁剧疆寰椾笉姝g‘锛屽湪绯荤粺涓病鏈夋壘鍒皗1}杩欎釜鐢熷懡鍛ㄦ湡",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()}); } - cbo.setLcStatus(lifeCycleVO.startState); + cbo.lcStatus = lifeCycleVO.startState; } } }else{ //鎴戜滑闇�瑕佸皢灞炴�у垵濮嬪寲 - if(StringUtils.isBlank(cbo.getOid()) || (newRevision || newVersion)){ - cbo.setOid(VciBaseUtil.getPk()); + if(StringUtils.isBlank(cbo.oid) || (newRevision || newVersion)){ + cbo.oid = VciBaseUtil.getPk(); } - if(StringUtils.isBlank(cbo.getCreator())){ - cbo.setCreator(VciBaseUtil.getCurrentUserId()); + if(StringUtils.isBlank(cbo.creator)){ + cbo.creator = VciBaseUtil.getCurrentUserId(); } - if(cbo.getCreateTime() != 0){ - cbo.setCreateTime(System.currentTimeMillis()); + if(cbo.createTime != 0){ + cbo.createTime = System.currentTimeMillis(); } - if(StringUtils.isBlank(cbo.getOwner())){ - cbo.setOwner(cbo.getCreator()); + if(StringUtils.isBlank(cbo.owner)){ + cbo.owner = cbo.creator; } - cbo.setTs(System.currentTimeMillis()); - if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId()) && (StringUtils.isBlank(cbo.getLcStatus()) || newRevision || newVersion)){ + cbo.ts = System.currentTimeMillis(); + if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId()) && (StringUtils.isBlank(cbo.lcStatus) || newRevision || newVersion)){ //鏌ヨ鐢熷懡鍛ㄦ湡 OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId()); if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.getOid())){ throw new VciBaseException("{0}閲岀殑鐢熷懡鍛ㄦ湡璁剧疆寰椾笉姝g‘锛屽湪绯荤粺涓病鏈夋壘鍒皗1}杩欎釜鐢熷懡鍛ㄦ湡",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()}); } - cbo.setLcStatus(lifeCycleVO.getStartStatus()); - cbo.setLctId(btmTypeVO.getLifeCycleId()); + cbo.lcStatus = lifeCycleVO.getStartStatus(); + cbo.lctId = btmTypeVO.getLifeCycleId(); } - if(StringUtils.isBlank(cbo.getBtmName())){ - cbo.setBtmName(btmTypeVO.getId()); + if(StringUtils.isBlank(cbo.btName)){ + cbo.btName = btmTypeVO.getId(); } + if(btmTypeVO.isRevisionFlag()){ //瑕佺鐞嗙増鏈� if(btmTypeVO.isInputRevisionFlag() && StringUtils.isNotBlank(baseDataMap.getOrDefault("revisionvalue",""))){ //鎵嬪姩鐨勶紝鎵�浠ヤ笉澶勭悊鐗堟湰瑙勫垯浜� - cbo.setRevisionValue(baseDataMap.get("revisionvalue")); + cbo.revisionValue = baseDataMap.get("revisionvalue"); }else { OsRevisionRuleVO ruleVO = revisionRuleServiceI.getRevisionRuleById(btmTypeVO.getRevisionRuleId()); if (ruleVO == null || StringUtils.isBlank(ruleVO.getOid())) { throw new VciBaseException("{0}閲岀殑鐗堟湰瑙勫垯璁剧疆寰椾笉姝g‘锛屽湪绯荤粺涓病鏈夋壘鍒皗1}杩欎釜鐗堟湰瑙勫垯", new String[]{btmTypeVO.getName(), btmTypeVO.getRevisionRuleId()}); } - cbo.setRevisionValue(ruleVO.getStartCode()); + cbo.revisionValue = ruleVO.getInitialValue(); } - if (StringUtils.isBlank(cbo.getNameoid())) { - cbo.setNameoid(VciBaseUtil.getPk()); + if (StringUtils.isBlank(cbo.nameoid)) { + cbo.nameoid = VciBaseUtil.getPk(); } - if (StringUtils.isBlank(cbo.getRevisionid())) { - cbo.setRevisionid(VciBaseUtil.getPk()); + if (StringUtils.isBlank(cbo.revisionid)) { + cbo.revisionid = VciBaseUtil.getPk(); } - cbo.setIsFirstR(true); - cbo.setIsLastR(true); - cbo.setRevisionRule(btmTypeVO.getRevisionRuleId()); - cbo.setRevisionSeq((short) 0); + cbo.isFirstR = true; + cbo.isLastR = true; + cbo.revisionRule = btmTypeVO.getRevisionRuleId(); + cbo.revisionSeq = (short) 0; //鐪嬬湅鏄惁闇�瑕佸鐞嗙増娆� - cbo.setVersionValue(getFirstVersion(btmTypeVO.getVersionRule())); - cbo.setVersionRule(btmTypeVO.getVersionRule()); - cbo.setVersionSeq((short) 0); - cbo.setIsLastV(true); - cbo.setIsFirstV(true); + cbo.versionValue = getFirstVersion(btmTypeVO.getVersionRule()); + cbo.versionRule = btmTypeVO.getVersionRule(); + cbo.versionSeq = (short) 0; + cbo.isLastV = true; + cbo.isFirstV = true; } } // Iterator<Map.Entry<String, String>> iterator = baseDataMap.entrySet().iterator(); @@ -2080,7 +2190,16 @@ // } // } setValueToCbo(dataLowMap,baseDataMap,cbo,editFlag); -// cbo.setName(dataLowMap.get("name")); + //TODO:榛樿灞炴�ч渶瑕佹斁鍦╟bo澶栧眰 + if(StringUtils.isNotBlank(baseDataMap.getOrDefault("id",""))){ + cbo.id = baseDataMap.getOrDefault("id",""); + } + if(StringUtils.isNotBlank(baseDataMap.getOrDefault("name",""))){ + cbo.name = baseDataMap.getOrDefault("name",""); + } + if(StringUtils.isNotBlank(baseDataMap.getOrDefault("description",""))){ + cbo.description = baseDataMap.getOrDefault("description",""); + } return cbo; } @@ -2111,18 +2230,12 @@ * @param editFlag 鏄惁涓虹紪杈� */ @Override - public void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, com.vci.client.bof.ClientBusinessObject cbo, boolean editFlag){ + public void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, BusinessObject cbo, boolean editFlag){ dataLow.forEach((key,value)->{ if(editFlag&¬SendOnEdit(key)){ //骞冲彴涓嶈兘浼犻�掕繖涓� }else{ - try { -// if(!SystemAttribute.bosysAttList().contains(key)){ - cbo.setAttributeValueWithNoCheck(key, value, !editFlag); -// } - } catch (PLException vciError) { - throw new VciBaseException("{0}鐨勫�间笉绗﹀悎瑕佹眰锛屽綋鍓嶆槸{1}", new String[]{key, value}, vciError); - } + ObjectTool.setBOAttributeValue(cbo,key,value); } }); baseDataLow.forEach((key,value)->{ @@ -2131,23 +2244,11 @@ }else{ if(editFlag) { //缂栬緫鐨勬椂鍊欏彲浠ラ兘璁剧疆 - try { -// if(!SystemAttribute.bosysAttList().contains(key)){ - cbo.setAttributeValueWithNoCheck(key, value, !editFlag); -// } - } catch (PLException vciError) { - throw new VciBaseException("{0}鐨勫�间笉绗﹀悎瑕佹眰锛屽綋鍓嶆槸{1}", new String[]{key, value}, vciError); - } + ObjectTool.setBOAttributeValue(cbo,key,value); }else{ //鍙渶瑕佸鐞唅d,name,description锛屽瘑绾у嵆鍙紝鍏朵綑鐨勯兘宸茬粡琚缃簡 if(basicFields.contains(key) &&StringUtils.isNotBlank(value)){ - try { -// if(!SystemAttribute.bosysAttList().contains(key)){ - cbo.setAttributeValueWithNoCheck(key, value, true); -// } - } catch (PLException vciError) { - throw new VciBaseException("{0}鐨勫�间笉绗﹀悎瑕佹眰锛屽綋鍓嶆槸{1}", new String[]{key, value}, vciError); - } + ObjectTool.setBOAttributeValue(cbo,key,value); } } } @@ -2162,7 +2263,7 @@ * @throws VciBaseException 鍙傛暟涓虹┖锛屽繀杈撻」缂哄け */ @Override - public BaseResult linkEditSave(FormLinkDataDTO formLinkDataDTO) throws VciBaseException { + public BaseResult linkEditSave(FormLinkDataDTO formLinkDataDTO) throws VciBaseException, PLException { VciBaseUtil.alertNotNull(formLinkDataDTO,"淇敼鐨勬暟鎹璞�",formLinkDataDTO.getLinkType(),"閾炬帴绫诲瀷鐨勫悕绉�", formLinkDataDTO.getFormDefineId(),"琛ㄥ崟瀹氫箟鐨勭紪鍙�",formLinkDataDTO.getOid(),"涓婚敭", formLinkDataDTO.getFoid(),"from绔富閿�",formLinkDataDTO.getToid(),"to绔富閿�"); @@ -2183,12 +2284,10 @@ //璇存槑鍓嶇疆浜嬩欢娌℃湁鎵ц鎴愬姛 return beforeResult; } - com.vci.client.bof.ClientLinkObject clo = null; + LinkObject clo = null; 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<>(); @@ -2201,10 +2300,10 @@ } }); } - com.vci.client.bof.ClientBusinessObject toCbo =null; + BusinessObject toCbo =null; if(!CollectionUtils.isEmpty(boData)) { //灏佽to绔殑 - BaseResult<com.vci.client.bof.ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO, formDefineVO, toOid, toBtmName, boData); + BaseResult<BusinessObject> result = wrapperToCbo(formLinkDataDTO, formDefineVO, toOid, toBtmName, boData); if (!result.isSuccess()) { return BaseResult.fail(result.getMsg(), result.getMsgObjs()); } @@ -2212,44 +2311,34 @@ } //鍒濆鍖栭摼鎺ョ被鍨嬬殑鍊� - BaseResult<com.vci.client.bof.ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, true); + BaseResult<LinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, true); if(!resultClo.isSuccess()){ return BaseResult.fail(resultClo.getMsg(),resultClo.getMsgObjs()); } clo = resultClo.getObj(); - if(toCbo!=null) { - if (formLinkDataDTO.isDirection()) { - clo.setFromBO(toCbo); - } else { - clo.setToBO(toCbo); - } - } -// LinkObjectHolder loHolder = new LinkObjectHolder(); -// loHolder.value = clo.getLinkObject(); try { -// platformClientUtil.getBOFactoryService().updateLinkObject(loHolder); - ClientServiceProvider.getBOFService().updateLinkObject(clo.getLinkObject()); + platformClientUtil.getBOFService().updateLinkObject(clo); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } //淇濆瓨to绔垨鑰協rom绔� try{ - platformClientUtil.getBOFactoryService().updateBusinessObject(toCbo.getBusinessObject()); + platformClientUtil.getBOFactoryService().updateBusinessObject(toCbo); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } if(!CollectionUtils.isEmpty(formLinkDataDTO.getReleaseFileOids())){ - fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.getOid(),formLinkDataDTO.getReleaseFileOids()); + fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.oid,formLinkDataDTO.getReleaseFileOids()); } //鍚庣疆浜嬩欢 String afterEvent = formLinkDataDTO.getPostEvent(); try { - callPostEvent(null,Arrays.stream(new com.vci.client.bof.ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); + callPostEvent(null,Arrays.stream(new LinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); }catch (Throwable e){ //鍚庣疆浜嬩欢鏈夐棶棰樹簡灏卞彧鑳芥槸杩欐牱浜嗭紝娌″姙娉曟仮澶� throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); } - return BaseResult.success(clo.getOid()); + return BaseResult.success(clo.oid); } /** @@ -2265,31 +2354,31 @@ if(deleteLinkDataDTO.getDataList().stream().anyMatch(s->StringUtils.isBlank(s.getOid()) || StringUtils.isBlank(s.getLinkType()))){ throw new VciBaseException("鏈夋暟鎹殑涓婚敭(鎴栭摼鎺ョ被鍨嬶級娌℃湁鍊硷紝鏃犳硶鍒犻櫎"); } - List<ClientLinkObject> clos = new ArrayList<>(); + List<LinkObject> clos = new ArrayList<>(); VciBaseUtil.switchListForOracleIn(deleteLinkDataDTO.getDataList()).stream().forEach(linkModelDTOs->{ Map<String,String> conditionMap = new HashMap<>(); conditionMap.put("oid",QueryOptionConstant.IN +"(" + VciBaseUtil.toInSql(linkModelDTOs.stream().map(BaseLinkModelDTO::getOid).toArray(String[]::new)) +")"); - List<ClientLinkObject> clientLinkObjects = loService.queryCLO(linkModelDTOs.get(0).getLinkType(), conditionMap); - if(!CollectionUtils.isEmpty(clientLinkObjects)){ - clos.addAll(clientLinkObjects); + List<LinkObject> LinkObjects = loService.queryCLO(linkModelDTOs.get(0).getLinkType(), conditionMap); + if(!CollectionUtils.isEmpty(LinkObjects)){ + clos.addAll(LinkObjects); } }); if(CollectionUtils.isEmpty(clos)){ throw new VciBaseException("浣跨敤涓婚敭娌℃湁鍦ㄧ郴缁熶腑鎵惧埌閾炬帴绫诲瀷鐨勬暟鎹�"); } - Map<String,List<ClientLinkObject>> fromBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.getFromBTMName())); - Map<String,List<ClientLinkObject>> toBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.getToBTMName())); - Map<String,List<com.vci.client.bof.ClientBusinessObject>> fromBtmDataGroups = new HashMap<>(); - Map<String,List<com.vci.client.bof.ClientBusinessObject>> toBtmDataGroups = new HashMap<>(); + Map<String,List<LinkObject>> fromBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.fromBTName)); + Map<String,List<LinkObject>> toBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.toBTName)); + Map<String,List<BusinessObject>> fromBtmDataGroups = new HashMap<>(); + Map<String,List<BusinessObject>> toBtmDataGroups = new HashMap<>(); if(!CollectionUtils.isEmpty(fromBtmGroups)){ fromBtmGroups.forEach((btmType,cloList)->{ - List<com.vci.client.bof.ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getFromOid).collect(Collectors.toList()), btmType); + List<BusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(clo -> clo.fromOid).collect(Collectors.toList()), btmType); fromBtmDataGroups.put(btmType,cbos); }); } if(!CollectionUtils.isEmpty(toBtmGroups)){ toBtmGroups.forEach((btmType,cloList)->{ - List<com.vci.client.bof.ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getToOid).collect(Collectors.toList()), btmType); + List<BusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(clo -> clo.toOid).collect(Collectors.toList()), btmType); toBtmDataGroups.put(btmType,cbos); }); } @@ -2304,19 +2393,19 @@ if(attr.toLowerCase().startsWith(LO_FROM_PREFIX)){ fromBtmDataGroups.forEach((btm,cbos)->{ String attrNotPrefix = attr.substring(LO_FROM_PREFIX.length()); - if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(s.getAttributeValue(attrNotPrefix)))){ + if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(ObjectTool.getBOAttributeValue(s, attrNotPrefix)))){ throw new VciBaseException("鏁版嵁鐨勫唴瀹逛笉鍏佽鍒犻櫎,{0}", new String[]{deleteLinkDataDTO.getCheckNotDeleteMsg()}); } }); }else if(attr.toLowerCase().startsWith(LO_TO_PREFIX)){ toBtmDataGroups.forEach((btm,cbos)->{ String attrNotPrefix = attr.substring(LO_TO_PREFIX.length()); - if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(s.getAttributeValue(attrNotPrefix)))){ + if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(ObjectTool.getBOAttributeValue(s, attrNotPrefix)))){ throw new VciBaseException("鏁版嵁鐨勫唴瀹逛笉鍏佽鍒犻櫎,{0}", new String[]{deleteLinkDataDTO.getCheckNotDeleteMsg()}); } }); }else { - if (clos.stream().anyMatch(s -> attrValue.equalsIgnoreCase(s.getAttributeValue(attr)))) { + if (clos.stream().anyMatch(s -> attrValue.equalsIgnoreCase(ObjectTool.getLOAttributeValue(s,attr)))) { throw new VciBaseException("鏁版嵁鐨勫唴瀹逛笉鍏佽鍒犻櫎,{0}", new String[]{deleteLinkDataDTO.getCheckNotDeleteMsg()}); } } @@ -2325,7 +2414,7 @@ //閾炬帴绫诲瀷鏈韩涓�鑸笉浼氭湁鍏宠仈 List<LinkObject> los = new ArrayList<>(); clos.stream().forEach(clo->{ - los.add(clo.getLinkObject()); + los.add(clo); }); try { platformClientUtil.getBOFactoryService().batchDeleteLinkObject(los.toArray(new LinkObject[0])); @@ -2335,7 +2424,7 @@ if(deleteLinkDataDTO.isDeleteFromData()){ fromBtmDataGroups.forEach((btm,cbos)->{ try{ - platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1); + platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]), DeleteTypeEnum.OID_AND_TS.getValue()); }catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -2344,7 +2433,7 @@ if(deleteLinkDataDTO.isDeleteToData()){ toBtmDataGroups.forEach((btm,cbos)->{ try{ - platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1); + platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),DeleteTypeEnum.OID_AND_TS.getValue()); }catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -2361,10 +2450,10 @@ * @return 鍒楄〃鏁版嵁 */ @Override - public DataGrid referDataGrid(ReferConfigVO referConfigVO, PageHelper pageHelper) { + public DataGrid referDataGrid(ReferConfigVO referConfigVO, PageHelper pageHelper) throws PLException { checkReferConfig(referConfigVO); //浣跨敤涓氬姟绫诲瀷鏌ヨ - OsBtmTypeVO btmById = btmService.getBtmById(referConfigVO.getReferBo()); + OsBtmTypeVO btmById = btmService.getBtmByName(referConfigVO.getReferBo()); if(referConfigVO.getConditionMap() == null){ referConfigVO.setConditionMap(new HashMap<>()); } @@ -2418,7 +2507,7 @@ referConfigVO.setConditionMap(new HashMap<>()); } - List<com.vci.client.bof.ClientBusinessObject> cbos = null; + List<BusinessObject> cbos = null; String oidFieldName = StringUtils.isNotBlank(referConfigVO.getParentUsedField())?referConfigVO.getParentUsedField():referConfigVO.getValueField(); if(referConfigVO.isSelectAllLevel()) { String parentOidSql = ""; @@ -2493,7 +2582,7 @@ @Override public List<Map<String,String>> getDataAttr(String btmname, String oid) { VciBaseUtil.alertNotNull(btmname,"涓氬姟绫诲瀷鐨勪俊鎭�",oid,"涓氬姟鏁版嵁鐨勪富閿�"); - List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); + List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); List<Map<String,String>> dataMap = new ArrayList<>(); if(!CollectionUtils.isEmpty(cbos)){ cbos.stream().forEach(cbo->{ @@ -2504,4 +2593,73 @@ } return dataMap; } + + /** + * 鏁版嵁鍗囩増鏈�/娆★紝鍓嶇浣跨敤JSON鎻愪氦 + * @param btmname 涓氬姟绫诲瀷鐨勪俊鎭� + * @param oid 涓氬姟鏁版嵁鐨勪富閿� + * @param type 1:鐗堟瀵硅薄锛�2锛氱増鏈璞★紱3锛氫富瀵硅薄 + * @return 鎵ц鐨勭粨鏋� + */ + @Override + public BaseResult deleteBusinessObject(String btmname, String oid, int type) throws PLException { + List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); + BaseResult<Object> objectBaseResult = new BaseResult<>(); + if(cbos.size() == 0){ + objectBaseResult.setSuccess(false); + throw new PLException("500", new String[]{"娌℃湁鑾峰彇鍒版暟鎹殑涓婚敭"}); + } + for (BusinessObject cbo : cbos) { + if(StringUtils.isBlank(cbo.revisionid)){ + String revisionoid = Arrays.stream(cbo.hisAttrValList).filter(e -> e.attrName.equals("REVISIONOID")).findFirst().map(e -> e.attrVal).orElse(""); + cbo.revisionid = revisionoid; + } + boolean b = platformClientUtil.getBOFService().deleteBusinessObject(cbo,type); + if(!b){ + throw new PLException("500", new String[]{"鏁版嵁鍒犻櫎澶辫触锛侊紒"}); + } + } + return BaseResult.success(); + } + /** + * 鍙樻洿鎵�鏈夎�� + * @param btmname 涓氬姟绫诲瀷 + * @param oid 涓婚敭 + * @return 鎵ц鐨勭粨鏋� + */ + @Override + public BaseResult changeBusinessObjectOwner(String btmname, String oid) throws PLException { + List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); + BaseResult<Object> objectBaseResult = new BaseResult<>(); + if(cbos.size() == 0){ + objectBaseResult.setSuccess(false); + throw new PLException("500", new String[]{"娌℃湁鑾峰彇鍒版暟鎹殑涓婚敭"}); + } + UserInfo userInfo = platformClientUtil.getFrameworkService().getUserObjectByUserName(WebUtil.getCurrentUserId()); + for (BusinessObject cbo : cbos) { + platformClientUtil.getBOFService().changeBusinessObjectOwner(cbo,userInfo); + } + return BaseResult.success(); + } + /** + * 鍙樻洿鎵�鏈夎�� + * @param btmname 涓氬姟绫诲瀷 + * @param oid 涓婚敭 + * @param releaseStatus 鍙戝竷鐘舵�� + * @return 鎵ц鐨勭粨鏋� + */ + @Override + @Transactional + public BaseResult transferBusinessObject(String btmname, String oid, String toStatus,String releaseStatus) throws PLException { + List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); + BaseResult<Object> objectBaseResult = new BaseResult<>(); + if(cbos.size() == 0){ + objectBaseResult.setSuccess(false); + throw new PLException("500", new String[]{"娌℃湁鑾峰彇鍒版暟鎹殑涓婚敭"}); + } + for (BusinessObject cbo : cbos) { + platformClientUtil.getBOFService().transferBusinessObjectAndRelease(cbo, toStatus, releaseStatus); + } + return BaseResult.success(); + } } -- Gitblit v1.9.3