From d2008fc35a45ff00b0f37939a13b792ab12e8c6f Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 21 十一月 2024 10:25:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java | 739 ++++++++++++++++++++++++++++++++------------------------
1 files changed, 425 insertions(+), 314 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..e07bba7 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,15 @@
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.corba.common.PLException;
+import com.vci.corba.framework.data.UserInfo;
+import com.vci.corba.omd.btm.BizType;
import com.vci.corba.omd.data.*;
import com.vci.corba.omd.lcm.LifeCycle;
-import com.vci.file.pagemodel.VciFileObjectVO;
+import com.vci.dto.*;
import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus;
import com.vci.frameworkcore.lcstatuspck.ReleaseDataLCStatus;
+import com.vci.omd.utils.ObjectTool;
+import com.vci.pagemodel.*;
import com.vci.starter.revision.bo.TreeWrapperOptions;
import com.vci.starter.web.annotation.bus.VciChangeDataAfter;
import com.vci.starter.web.annotation.bus.VciChangeDataBefore;
@@ -23,10 +22,9 @@
import com.vci.starter.web.pagemodel.*;
import com.vci.starter.web.util.*;
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;
@@ -37,13 +35,15 @@
import org.apache.commons.lang3.StringUtils;
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 +70,11 @@
*/
@Autowired
private OsBtmServiceI btmService;
+ /**
+ * 灞炴�ф湇鍔�
+ */
+ @Autowired
+ private OsAttributeServiceI attrService;
/**
* 閾炬帴绫诲瀷
@@ -131,10 +136,10 @@
* @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
@Override
- public DataGrid getDataForGrid(UIDataGridQuery dataGridQuery) throws VciBaseException {
+ public DataGrid getDataForGrid(UIDataGridQuery dataGridQuery) throws VciBaseException, PLException {
VciBaseUtil.alertNotNull(dataGridQuery,"鏌ヨ瀵硅薄",dataGridQuery.getBtmname(),"涓氬姟绫诲瀷",dataGridQuery.getTableDefineId());
//鍏堝垽鏂煡璇㈡ā鏉�
- UITableDefineVO tableDefineVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid()).getTableDefineVO();
+ UITableDefineVO tableDefineVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid(),null).getTableDefineVO();
String queryTemplate = !CollectionUtils.isEmpty(dataGridQuery.getSourceData())?dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()):tableDefineVO.getQueryTemplateName();
if(StringUtils.isBlank(queryTemplate)){
//璇存槑娌℃湁璁剧疆鏌ヨ妯℃澘锛岄渶瑕佺湅鐪嬪湪杩欎釜琛ㄦ牸鎵�鍦ㄧ殑缁勪欢鏈夋病鏈夎缃�
@@ -172,7 +177,8 @@
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());
}
@@ -193,8 +199,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,7 +215,7 @@
* @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();
@@ -238,7 +245,7 @@
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");
@@ -248,7 +255,7 @@
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 +264,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);
@@ -338,9 +345,10 @@
* @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
@Override
- public List<Tree> getDataForTree(UITreeQuery treeQuery) throws VciBaseException {
+ public List<Tree> getDataForTree(UITreeQuery treeQuery) throws VciBaseException, PLException {
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("鏍戠殑閰嶇疆淇℃伅娌℃湁鑾峰彇鍒�");
}
@@ -383,7 +391,7 @@
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 +400,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);
@@ -428,7 +436,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 {
@@ -535,6 +543,62 @@
}
/**
+ * 鑾峰彇鏁版嵁(鏍规嵁鏌ヨ妯℃澘鏌ヨ瀵硅薄锛岃繑鍥炵殑缁撴瀯鎸夌収ui瀹氫箟锛屽畾涔夌殑妯℃澘绫诲瀷杩斿洖)
+ * @param treeQuery 鏍戝舰鏌ヨ鏉′欢
+ * @return 鏍戝舰鏁版嵁
+ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ @Override
+ public BaseResult getDataByTemp(UITreeQuery treeQuery) throws VciBaseException, PLException {
+ 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銆佹牴鎹厤缃殑鏌ヨ妯℃澘鏌ヨ鏁版嵁(闇�瑕佽�冭檻鍏ㄩ潰涓�鐐�),
+ // 杩欏効鏍规嵁褰撳墠绫诲瀷鏉ヨ幏鍙栨槸浠�涔堢被鍨嬬殑鏌ヨ妯℃澘锛岀劧鍚庡仛瀵瑰簲鐨勬煡璇㈠鐞�
+
+ UITreeDefineVO treeDefineVO = componentVO.getTreeDefineVO();
+ String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())?treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()):treeDefineVO.getQueryTemplateName());
+ Map<String, String> replaceMap = wrapperReplaceMap(treeQuery.getSourceData());
+ List<String> queryFieldList = new ArrayList<>();
+ 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 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<Tree> 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);
+ }
+
+ /**
* 涓氬姟绫诲瀷鐨勫睘鎬ф煡璇�
* @param rootTreeList 鏍硅妭鐐圭殑鍐呭
* @param queryTemplate 鏌ヨ妯℃澘
@@ -543,7 +607,7 @@
*/
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;
+ List<BusinessObject> thisChildren = null;
Map<String,String> sourceDataMap = rootTree.getAttributes();
sourceDataMap.put("f_oid",rootTree.getOid());
Map<String,String> conditionMap = new HashMap<>();
@@ -590,7 +654,7 @@
* @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<Tree> 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<>();
@@ -599,7 +663,7 @@
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));
tree.setIndex(i[0] + "");
@@ -634,10 +698,10 @@
List<Tree> 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);
+ BusinessObject cbo = new BusinessObject();
+ cbo = boAndLO.bo;
+ LinkObject clo = new LinkObject();
+ clo = boAndLO.lo;
Map<String,String> cloMap = loService.clo2Map(clo);
Map<String,String> cbo2Map = boService.cbo2Map(cbo);
if(!CollectionUtils.isEmpty(cbo2Map)){
@@ -651,9 +715,9 @@
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));
}
}
@@ -678,7 +742,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 +753,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();
}
@@ -763,7 +827,7 @@
* @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();
}
@@ -870,12 +934,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鐨勫悕瀛�#鏂规硶; 鎴栬�呭叏璺緞銆傛渶鍚庝竴涓槸鏂规硶鐨勫悕瀛�
@@ -1049,7 +1113,7 @@
* @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());
@@ -1061,35 +1125,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 +1169,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 +1197,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 +1210,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 +1220,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 +1302,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 +1318,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 +1332,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 +1345,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,7 +1378,7 @@
* @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();
@@ -1332,26 +1393,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) {
@@ -1369,7 +1429,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,7 +1448,7 @@
* @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());
@@ -1400,26 +1460,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,7 +1493,7 @@
* @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());
@@ -1445,29 +1504,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,7 +1552,7 @@
* @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();
@@ -1497,16 +1567,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 {
@@ -1539,15 +1609,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();
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 +1633,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 +1650,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 +1674,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 +1687,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 +1703,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 +1727,7 @@
//璇存槑鍓嶇疆浜嬩欢娌℃湁鎵ц鎴愬姛
return beforeResult;
}
- com.vci.client.bof.ClientLinkObject clo = null;
+ LinkObject clo = null;
String prefix = "";
if(formLinkDataDTO.isDirection()){
prefix = LO_FROM_PREFIX;
@@ -1681,14 +1754,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 +1763,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 +1814,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 +1830,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 +1879,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 +1906,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 +1999,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 +2143,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 +2183,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 +2197,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 +2216,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 +2237,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 +2253,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 +2264,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 +2307,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 +2346,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 +2367,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 +2377,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 +2386,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 +2403,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 +2460,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 +2535,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 +2546,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