Source/platformProject/vci-platform-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
@@ -1,6 +1,8 @@
package com.vci.web.service.impl;
import com.vci.client.common.providers.ServiceProvider;
import com.vci.corba.common.VCIError;
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;
@@ -246,7 +248,7 @@
        UIFormDataVO formDataVO = new UIFormDataVO();
        replaceMap.put("oid", formQuery.getOid().trim());
        if(!formDefineVO.isLinkTypeFlag()) {
            List<ClientBusinessObject> cbos = null;
            List<com.vci.client.bof.ClientBusinessObject> cbos = null;
            if (StringUtils.isNotBlank(queryTemplate)) {
                replaceMap.put("oid", formQuery.getOid().trim());
                cbos = boService.queryCBOByScheme(queryTemplate, conditionMap, replaceMap, null, queryFieldList.stream().collect(Collectors.toList()));
@@ -255,7 +257,7 @@
                cbos = boService.queryCBO(formQuery.getBtmname(), conditionMap, null, queryFieldList.stream().collect(Collectors.toList()));
            }
            if (!CollectionUtils.isEmpty(cbos)) {
                ClientBusinessObject cbo = cbos.get(0);
                com.vci.client.bof.ClientBusinessObject cbo = cbos.get(0);
                formDataVO.setData(boService.cbo2Map(cbo));
            } else {
                throw new VciBaseException(DATA_OID_NOT_EXIST);
@@ -390,7 +392,7 @@
            if(treeQuery.isQueryRoot()){
                //是查询根节点
                List<ClientBusinessObject> rootCbos = null;
                List<com.vci.client.bof.ClientBusinessObject> rootCbos = null;
                if(StringUtils.isNotBlank(queryTemplate)){
                    //说明是菜单里定义了查询模板的
                    rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap);
@@ -426,7 +428,7 @@
                return rootTreeList;
            }else{
                //这个不是跟节点,但是一般只是增加一个逐级查询,因为全部查询的时候,在根节点已经全部查询完了
                List<ClientBusinessObject> thisChildren = null;
                List<com.vci.client.bof.ClientBusinessObject> thisChildren = null;
                if (StringUtils.isNotBlank(queryTemplate)) {
                    thisChildren = boService.queryCBOByScheme(queryTemplate, treeQuery.getConditionMap(), replaceMap, null, queryFieldList);
                } else {
@@ -455,7 +457,7 @@
            }
            if(treeQuery.isQueryRoot()){
                //查询根节点.我们需要判断是否设置了根节点的查询条件
                List<BOAndLO> rootCbos = null;
                List<com.vci.corba.query.data.BOAndLO> rootCbos = null;
                String parentFieldNameAndValue = treeDefineVO.getShowLinkAbs();
                if(StringUtils.isNotBlank(parentFieldNameAndValue)){
                    if(StringUtils.isNotBlank(queryTemplate)){
@@ -541,7 +543,7 @@
     */
    private void queryTreeForBO(List<Tree> rootTreeList, String queryTemplate,List<String> queryFieldList,TreeQueryObject treeQueryObject) {
        for (Tree rootTree : rootTreeList) {
            List<ClientBusinessObject> thisChildren = null;
            List<com.vci.client.bof.ClientBusinessObject> thisChildren = null;
            Map<String,String> sourceDataMap = rootTree.getAttributes();
            sourceDataMap.put("f_oid",rootTree.getOid());
            Map<String,String> conditionMap = new HashMap<>();
@@ -588,7 +590,7 @@
     * @param parentOid 上级的主键
     * @return 树
     */
    private List<Tree> cbo2Trees(Collection<ClientBusinessObject> cbos,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){
    private List<Tree> cbo2Trees(Collection<com.vci.client.bof.ClientBusinessObject> 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<>();
@@ -610,7 +612,9 @@
                children.add(tree);
            }
        });
        if(rootList.size() == 0 && children.size() == 0){
            return rootList;
        }
        return Tree.getChildList(rootList,children);
    }
@@ -624,15 +628,15 @@
     * @param parentOid 上级的值
     * @return 树形数据
     */
    public List<Tree> cloAndCbo2Trees(Collection<BOAndLO> boAndLOS,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){
    public List<Tree> cloAndCbo2Trees(Collection<com.vci.corba.query.data.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<>();
        boAndLOS.stream().forEach(boAndLO->{
            Tree tree = new Tree();
            ClientBusinessObject cbo = new ClientBusinessObject();
            com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject();
            cbo.setBusinessObject(boAndLO.bo);
            ClientLinkObject clo = new ClientLinkObject();
            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);
@@ -674,7 +678,7 @@
     * @param fieldExpress 表达式的值
     * @return 转换后的值
     */
    private String getValueByExpress(ClientBusinessObject cbo,String fieldExpress){
    private String getValueByExpress(com.vci.client.bof.ClientBusinessObject cbo,String fieldExpress){
        if(StringUtils.isBlank(fieldExpress)){
            return "";
        }
@@ -866,12 +870,12 @@
     * @throws VciBaseException 执行出错的会抛出异常,或者事件直接返回了异常
     */
    @Override
    public BaseResult callPostEvent(Collection<ClientBusinessObject> cbos, Collection<ClientLinkObject> clos, String postEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException{
    public BaseResult callPostEvent(Collection<com.vci.client.bof.ClientBusinessObject> cbos, Collection<com.vci.client.bof.ClientLinkObject> 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().linkTypeName:null;
        String linkType = !CollectionUtils.isEmpty(clos)?clos.stream().findFirst().get().getLinkObject().ltName:null;
        if(StringUtils.isNotBlank(postEvent)){
            //前置事件
            //bean的名字#方法; 或者全路径。最后一个是方法的名字
@@ -1057,16 +1061,17 @@
            return beforeResult;
        }
        //封装数据
        BaseResult<ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,false,false);
        BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,false,false);
        if(!resultCbo.isSuccess()){
            return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs());
        }
        //执行保存
        BaseResult<Map<String,Object>> result = BaseResult.success();
        ClientBusinessObject afterCBO = null;
        com.vci.client.bof.ClientBusinessObject afterCBO = null;
        try {
            BusinessObject resultBO = platformClientUtil.getBOFactoryService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false);
            afterCBO = new ClientBusinessObject();
//            BusinessObject resultBO = platformClientUtil.getBOFactoryService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false);
            com.vci.corba.omd.data.BusinessObject resultBO = ServiceProvider.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false);
            afterCBO = new com.vci.client.bof.ClientBusinessObject();
            afterCBO.setBusinessObject(resultBO);
            result.setObj(boService.cbo2Map(afterCBO));
        } catch (VCIError vciError) {
@@ -1078,11 +1083,12 @@
        //后置事件
        String afterEvent = formDataDTO.getPostEvent();
        try {
            callPostEvent(Arrays.stream(new ClientBusinessObject[]{afterCBO}).collect(Collectors.toList()),null, afterEvent, VciChangeDocumentTypeEnum.ADD);
            callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{afterCBO}).collect(Collectors.toList()),null, afterEvent, VciChangeDocumentTypeEnum.ADD);
        }catch (Throwable e){
            //说明后置事件出现了错误,那么就需要删除以前的这条数据
            try {
                platformClientUtil.getBOFactoryService().deleteBusinessObject(afterCBO.getBusinessObject(),1);
//                platformClientUtil.getBOFactoryService().deleteBusinessObject(afterCBO.getBusinessObject(),1);
                ServiceProvider.getBOFService().deleteBusinessObject(afterCBO.getBusinessObject(),1);
            } catch (VCIError vciError) {
                throw WebUtil.getVciBaseException(vciError);
            }
@@ -1101,7 +1107,7 @@
     * @param newVersion 新版次
     * @return  执行的结果
     */
    private BaseResult<ClientBusinessObject> wrapperCbo(FormDataDTO formDataDTO,UIFormDefineVO formDefineVO,boolean editFlag,boolean newRevision,boolean newVersion){
    private BaseResult<com.vci.client.bof.ClientBusinessObject> wrapperCbo(FormDataDTO formDataDTO,UIFormDefineVO formDefineVO,boolean editFlag,boolean newRevision,boolean newVersion){
        //扩展属性的值
        Map<String, String> data = formDataDTO.getData();
        Map<String,String> dataLow = new HashMap<>();
@@ -1142,7 +1148,7 @@
        if(!result.isSuccess()){
            return result;
        }
        ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,newRevision,newVersion);
        com.vci.client.bof.ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,newRevision,newVersion);
        return BaseResult.success(cbo);
    }
@@ -1152,7 +1158,7 @@
     * @return 基础对象
     */
    @Override
    public BaseModel cbo2BaseModel(ClientBusinessObject cbo){
    public BaseModel cbo2BaseModel(com.vci.client.bof.ClientBusinessObject cbo){
        BaseModel baseModel = new BaseModel();
        baseModel.setOid(cbo.getOid());
        baseModel.setNameOid(cbo.getNameoid());
@@ -1164,11 +1170,11 @@
        baseModel.setFirstV(String.valueOf(cbo.getIsFirstV()));
        baseModel.setCreator(cbo.getCreator());
        try {
            baseModel.setCreateTime(VciDateUtil.str2Date(cbo.getCreateTime(), VciDateUtil.DateTimeFormat));
            baseModel.setLastModifyTime(VciDateUtil.str2Date(cbo.getLastModifyTime(), VciDateUtil.DateTimeFormat));
            baseModel.setTs(VciDateUtil.str2Date(cbo.getTs(), VciDateUtil.DateTimeFormat));
            baseModel.setCheckInTime(VciDateUtil.str2Date(cbo.getCheckinTime(), VciDateUtil.DateTimeFormat));
            baseModel.setCheckOutTime(VciDateUtil.str2Date(cbo.getCheckoutTime(), VciDateUtil.DateTimeFormat));
            baseModel.setCreateTime(new Date(cbo.getCreateTime()));
            baseModel.setLastModifyTime(new Date(cbo.getLastModifyTime()));
            baseModel.setTs(new Date(cbo.getTs()));
//            baseModel.setCheckInTime(VciDateUtil.str2Date(cbo.getCheckinTime(), VciDateUtil.DateTimeFormat));
//            baseModel.setCheckOutTime(VciDateUtil.str2Date(cbo.getCheckoutTime(), VciDateUtil.DateTimeFormat));
        }catch (Throwable e){
        }
@@ -1184,8 +1190,8 @@
        baseModel.setName(cbo.getName());
        baseModel.setDescription(cbo.getDescription());
        baseModel.setOwner(cbo.getOwner());
        baseModel.setCheckInBy(cbo.getCheckinBy());
        baseModel.setCheckOutBy(cbo.getCheckoutBy());
//        baseModel.setCheckInBy(cbo.getCheckinBy());
//        baseModel.setCheckOutBy(cbo.getCheckoutBy());
        baseModel.setCopyFromVersion(cbo.getCopyFromVersion());
        return baseModel;
    }
@@ -1323,12 +1329,12 @@
            return beforeResult;
        }
        //封装数据
        List<BusinessObject> addBos = new ArrayList<>();
        List<BusinessObject> afterBOs = new ArrayList<>();
        List<ClientBusinessObject> afterCBOs = new ArrayList<>();
        List<com.vci.corba.omd.data.BusinessObject> addBos = new ArrayList<>();
        List<com.vci.corba.omd.data.BusinessObject> afterBOs = new ArrayList<>();
        List<com.vci.client.bof.ClientBusinessObject> afterCBOs = new ArrayList<>();
        Map<String,List<String>> releasedFileOids = new HashMap<>();
        for(FormDataDTO formDataDTO:formDataDTOList.getFormDataDTOS()) {
            BaseResult<ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, false, false, false);
            BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, false, false, false);
            if (!resultCbo.isSuccess()) {
                return BaseResult.fail(resultCbo.getMsg(), resultCbo.getMsgObjs());
            }
@@ -1339,10 +1345,11 @@
            }
        }
        try {
            BusinessObject[] resultBOs = platformClientUtil.getBOFactoryService().batchCreateBusinessObject(addBos.toArray(new BusinessObject[0]), false, false);
//            com.vci.corba.omd.data.BusinessObject[] resultBOs = platformClientUtil.getBOFactoryService().batchCreateBusinessObject(addBos.toArray(new BusinessObject[0]), false, false);
            com.vci.corba.omd.data.BusinessObject[] resultBOs = ServiceProvider.getBOFService().batchCreateBusinessObject(addBos.toArray(new com.vci.corba.omd.data.BusinessObject[0]), false, false);
            afterBOs = Arrays.stream(resultBOs).collect(Collectors.toList());
            Arrays.stream(resultBOs).forEach(bo->{
                ClientBusinessObject cbo = new ClientBusinessObject();
                com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject();
                cbo.setBusinessObject(bo);
                afterCBOs.add(cbo);
            });
@@ -1392,14 +1399,15 @@
            return beforeResult;
        }
        //封装数据
        BaseResult<ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,true,false,false);
        BaseResult<com.vci.client.bof.ClientBusinessObject> 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()));
//            platformClientUtil.getBOFactoryService().updateBusinessObject(new BusinessObjectHolder(resultCbo.getObj().getBusinessObject()));
            ServiceProvider.getBOFService().updateBusinessObject(resultCbo.getObj().getBusinessObject());
            result.setObj(boService.cbo2Map(resultCbo.getObj()));
        } catch (VCIError vciError) {
            throw WebUtil.getVciBaseException(vciError);
@@ -1410,7 +1418,7 @@
        //后置事件
        String afterEvent = formDataDTO.getPostEvent();
        try {
            callPostEvent(Arrays.stream(new ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT);
            callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT);
        }catch (Throwable e){
            throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e);
        }
@@ -1437,15 +1445,16 @@
            return beforeResult;
        }
        //封装数据
        BaseResult<ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion());
        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());
        }
        //执行保存
        BaseResult<Map<String,Object>> result = BaseResult.success();
        try {
            BusinessObject bo = platformClientUtil.getBOFactoryService().createBusinessObject(resultCbo.getObj().getBusinessObject(),formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion());
            ClientBusinessObject afterCbo = new ClientBusinessObject();
//            BusinessObject bo = platformClientUtil.getBOFactoryService().createBusinessObject(resultCbo.getObj().getBusinessObject(),formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion());
            com.vci.corba.omd.data.BusinessObject bo = ServiceProvider.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 (VCIError vciError) {
@@ -1457,7 +1466,7 @@
        //后置事件
        String afterEvent = formDataDTO.getPostEvent();
        try {
            callPostEvent(Arrays.stream(new ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT);
            callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT);
        }catch (Throwable e){
            throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e);
        }
@@ -1485,11 +1494,11 @@
            return beforeResult;
        }
        //封装数据
        List<BusinessObject> updateCBOS = new ArrayList<>();
        List<com.vci.corba.omd.data.BusinessObject> updateCBOS = new ArrayList<>();
        Map<String,List<String>> releasedFileOids = new HashMap<>();
        List<ClientBusinessObject> afterCBOs = new ArrayList<>();
        List<com.vci.client.bof.ClientBusinessObject> afterCBOs = new ArrayList<>();
        for(FormDataDTO formDataDTO:formDataDTOList.getFormDataDTOS()) {
            BaseResult<ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, true, false, false);
            BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, true, false, false);
            if (!resultCbo.isSuccess()) {
                return BaseResult.fail(resultCbo.getMsg(), resultCbo.getMsgObjs());
            }
@@ -1534,7 +1543,7 @@
        String btmName = deleteDataDTO.getDataList().get(0).getBtmname();
        List<String> oidList = deleteDataDTO.getDataList().stream().map(BaseModelDTO::getOid).collect(Collectors.toList());
        //看看级联删除。只有自己引用自己的时候可以级联删除
        List<ClientBusinessObject> cbo = null;
        List<com.vci.client.bof.ClientBusinessObject> cbo = null;
        if(deleteDataDTO.isCascade()){
            //级联删除
            OsBtmTypeVO btmTypeVO = btmService.getBtmById(btmName);
@@ -1553,8 +1562,8 @@
        if(CollectionUtils.isEmpty(cbo)){
            return BaseResult.fail("没有在系统中找到这些数据,未执行删除操作");
        }
        List<ClientBusinessObject> finalCbo = cbo;
        Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(finalCbo.stream().map(ClientBusinessObject::getOid).collect(Collectors.toList()));
        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<OsUsedAttributeVO> usedAttributeVOS = null;
        boolean adminCascade = false;
        if("admin".equalsIgnoreCase(VciBaseUtil.getCurrentUserId()) && deleteDataDTO.isAdminCascade()){
@@ -1589,7 +1598,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<ClientBusinessObject> tempCbos = boService.queryCBO(usedAttributeVO.getPkBtmType(), conditionMap);
                            List<com.vci.client.bof.ClientBusinessObject> tempCbos = boService.queryCBO(usedAttributeVO.getPkBtmType(), conditionMap);
                            if(!CollectionUtils.isEmpty(tempCbos)){
                                finalCbo.addAll(tempCbos);
                            }
@@ -1642,7 +1651,7 @@
            //说明前置事件没有执行成功
            return beforeResult;
        }
        ClientLinkObject clo = null;
        com.vci.client.bof.ClientLinkObject clo = null;
        String prefix = "";
        if(formLinkDataDTO.isDirection()){
            prefix = LO_FROM_PREFIX;
@@ -1670,9 +1679,10 @@
        }
        //查询from端的
        ClientBusinessObject fromCbo = new ClientBusinessObject();
        com.vci.client.bof.ClientBusinessObject fromCbo = new com.vci.client.bof.ClientBusinessObject();
        try {
            fromCbo.setBusinessObject(platformClientUtil.getBOFactoryService().readBusinessObject(fromOid,fromBtmName));
//            fromCbo.setBusinessObject(platformClientUtil.getBOFactoryService().readBusinessObject(fromOid,fromBtmName));
            fromCbo.setBusinessObject(ServiceProvider.getBOFService().readBusinessObject(fromOid,fromBtmName));
        } catch (VCIError vciError) {
            throw WebUtil.getVciBaseException(vciError);
        }
@@ -1685,13 +1695,13 @@
            }
        });
        //封装to端的
        BaseResult<ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO,formDefineVO,toOid,toBtmName,boData);
        BaseResult<com.vci.client.bof.ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO,formDefineVO,toOid,toBtmName,boData);
        if(!result.isSuccess()){
            return BaseResult.fail(result.getMsg(),result.getMsgObjs());
        }
        ClientBusinessObject toCbo = result.getObj();
        com.vci.client.bof.ClientBusinessObject toCbo = result.getObj();
        //初始化链接类型的值
        BaseResult<ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, false);
        BaseResult<com.vci.client.bof.ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, false);
        if(!resultClo.isSuccess()){
            return BaseResult.fail(resultClo.getMsg(),resultClo.getMsgObjs());
        }
@@ -1704,16 +1714,13 @@
            clo.setToBO(toCbo);
        }
        //执行保存
        BusinessObject[] bos = new BusinessObject[1];
        com.vci.corba.omd.data.BusinessObject[] bos = new com.vci.corba.omd.data.BusinessObject[1];
        toCbo.dealBusinessObjectNullValue();
        clo.dealLinkObjectNullValue();
        bos[0] = toCbo.getBusinessObject();
        BusinessObjectListHolder bosHolder = new BusinessObjectListHolder();
        bosHolder.value = bos;
        LinkObjectHolder loHolder = new LinkObjectHolder();
        loHolder.value = clo.getLinkObject();
        try {
            platformClientUtil.getBOFactoryService().createBusinessObjectWithLink(bosHolder,loHolder);
//            platformClientUtil.getBOFactoryService().createBusinessObjectWithLink(bosHolder,loHolder);
            ServiceProvider.getBOFService().createBusinessObjectWithLink(bos,clo.getLinkObject());
        } catch (VCIError vciError) {
            throw WebUtil.getVciBaseException(vciError);
        }
@@ -1723,12 +1730,14 @@
        //后置事件
        String afterEvent = formLinkDataDTO.getPostEvent();
        try {
            callPostEvent(null,Arrays.stream(new ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD);
            callPostEvent(null,Arrays.stream(new com.vci.client.bof.ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD);
        }catch (Throwable e){
            //说明后置事件出现了错误,那么就需要删除以前的这条数据
            try {
                platformClientUtil.getBOFactoryService().deleteBusinessObject(toCbo.getBusinessObject(),1);
                platformClientUtil.getBOFactoryService().deleteLinkObject(clo.getLinkObject());
//                platformClientUtil.getBOFactoryService().deleteBusinessObject(toCbo.getBusinessObject(),1);
//                platformClientUtil.getBOFactoryService().deleteLinkObject(clo.getLinkObject());
                ServiceProvider.getBOFService().deleteBusinessObject(toCbo.getBusinessObject(),1);
                ServiceProvider.getBOFService().deleteLinkObject(clo.getLinkObject());
            } catch (VCIError vciError) {
                throw WebUtil.getVciBaseException(vciError);
            }
@@ -1745,7 +1754,7 @@
     * @param editFlag 是否为编辑
     * @return 链接类型的内容
     */
    private BaseResult<ClientLinkObject> wrapperOnlyCLO(FormLinkDataDTO formLinkDataDTO,Map<String,String> loData,UIFormDefineVO formDefineVO,boolean editFlag){
    private BaseResult<com.vci.client.bof.ClientLinkObject> 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);
@@ -1761,22 +1770,23 @@
            return result;
        }
        //处理业务类型得到数据
        ClientLinkObject clo ;
        com.vci.client.bof.ClientLinkObject clo ;
        if(editFlag){
            try {
                LinkObject linkObject = platformClientUtil.getBOFactoryService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType());
                clo = new ClientLinkObject();
//                LinkObject linkObject = platformClientUtil.getBOFactoryService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType());
                com.vci.corba.omd.data.LinkObject linkObject = ServiceProvider.getBOFService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType());
                clo = new com.vci.client.bof.ClientLinkObject();
                clo.setLinkObject(linkObject);
            } catch (VCIError vciError) {
                throw WebUtil.getVciBaseException(vciError);
            }
        }else{
            clo = new ClientLinkObject();
            clo = new com.vci.client.bof.ClientLinkObject();
            //处理初始化的数据
            clo.setOid(VciBaseUtil.getPk());
            clo.setCreator(VciBaseUtil.getCurrentUserId());
            clo.setCreateTime(VciDateUtil.getNowString());
            clo.setTs(VciDateUtil.getNowString());
            clo.setCreateTime(System.currentTimeMillis());
            clo.setTs(System.currentTimeMillis());
            clo.setLoName(formLinkDataDTO.getLinkType());
        }
        //
@@ -1802,7 +1812,7 @@
     * @param boData to的数据
     * @return 包含的对象
     */
    private BaseResult<ClientBusinessObject> wrapperToCbo(FormLinkDataDTO formLinkDataDTO,UIFormDefineVO formDefineVO,String toOid,String toBtmName,Map<String,String> boData){
    private BaseResult<com.vci.client.bof.ClientBusinessObject> wrapperToCbo(FormLinkDataDTO formLinkDataDTO,UIFormDefineVO formDefineVO,String toOid,String toBtmName,Map<String,String> boData){
        Map<String,String> dataLow = new HashMap<>();
        boData.forEach((key,value)->{
            dataLow.put(key.toLowerCase(),value);
@@ -1829,7 +1839,7 @@
        if(!result.isSuccess()){
            return result;
        }
        ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,formLinkDataDTO.isToUpRevision(),formLinkDataDTO.isToUpVersion());
        com.vci.client.bof.ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,formLinkDataDTO.isToUpRevision(),formLinkDataDTO.isToUpVersion());
        return BaseResult.success(cbo);
    }
@@ -1922,15 +1932,17 @@
     * @param newVersion 是否升版次
     * @return cbo对象
     */
    public ClientBusinessObject createOrGetCbo(Map<String,String> dataLowMap,Map<String,String> baseDataMap,boolean editFlag,boolean newRevision,boolean newVersion){
    public com.vci.client.bof.ClientBusinessObject createOrGetCbo(Map<String,String> dataLowMap,Map<String,String> baseDataMap,boolean editFlag,boolean newRevision,boolean newVersion){
        String btmName = baseDataMap.get("btmname");
        String oid = baseDataMap.get("oid");
        ClientBusinessObject cbo = new ClientBusinessObject();
//        ClientBusinessObject cbo = new ClientBusinessObject();
        com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject();
        String copyfromversion = baseDataMap.get("copyfromversion");
        OsBtmTypeVO btmTypeVO = btmService.getBtmById(btmName);
        if(editFlag || newRevision || newVersion){
            try {
                cbo.setBusinessObject(platformClientUtil.getBOFactoryService().readBusinessObject(editFlag?oid:copyfromversion,btmName));
//                cbo.setBusinessObject(platformClientUtil.getBOFactoryService().readBusinessObject(editFlag?oid:copyfromversion,btmName));
                cbo.setBusinessObject(ServiceProvider.getBOFService().readBusinessObject(editFlag?oid:copyfromversion,btmName));
            } catch (VCIError vciError) {
                throw new VciBaseException("使用主键在系统中没有查询到数据",new String[]{oid},vciError);
            }
@@ -1945,25 +1957,31 @@
                    BaseModel baseModel = cbo2BaseModel(cbo);
                    RevisionValueObject revisionValueObject = getNextRevision(btmTypeVO,baseModel);
                    cbo.setRevisionid(VciBaseUtil.getPk());
                    cbo.setRevisionSeq(revisionValueObject.getRevisionSeq());
                    cbo.setRevisionSeq((short) revisionValueObject.getRevisionSeq());
                    cbo.setRevisionValue(revisionValueObject.getRevisionVal());
                    cbo.setIsLastR(1);
                    cbo.setIsFirstR(0);
                    cbo.setIsLastR(true);
                    cbo.setIsFirstR(false);
                    //处理版次
                    cbo.setVersionValue(getFirstVersion(btmTypeVO.getVersionRule()));
                    cbo.setVersionRule(btmTypeVO.getVersionRule());
                    cbo.setVersionSeq(0);
                    cbo.setIsLastV(1);
                    cbo.setIsFirstV(1);
                    cbo.setVersionSeq((short) 0);
                    cbo.setIsLastV(true);
                    cbo.setIsFirstV(true);
                }
                //升版的时候,生命周期的状态需要改动到默认状态
                if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){
                    //查询生命周期
                    OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId());
                    if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.getOid())){
//                    OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId());
                    LifeCycle lifeCycleVO = null;
                    try {
                        lifeCycleVO = ServiceProvider.getOMDService().getLifeCycleService().getLifeCycle(btmTypeVO.getLifeCycleId());
                    } catch (VCIError e) {
                        throw new RuntimeException(e);
                    }
                    if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.oid)){
                        throw new VciBaseException("{0}里的生命周期设置得不正确,在系统中没有找到{1}这个生命周期",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()});
                    }
                    cbo.setLcStatus(lifeCycleVO.getStartStatus());
                    cbo.setLcStatus(lifeCycleVO.startState);
                }
            }
            if(btmTypeVO.isRevisionFlag() && newVersion){
@@ -1973,17 +1991,23 @@
                BaseModel baseModel = cbo2BaseModel(cbo);
                VersionValueObject versionValueObject = getNextVersion(btmTypeVO,baseModel);
                cbo.setVersionValue(versionValueObject.getVersionVal());
                cbo.setVersionSeq(versionValueObject.getVersionSeq());
                cbo.setIsLastV(1);
                cbo.setIsFirstV(0);
                cbo.setVersionSeq((short) versionValueObject.getVersionSeq());
                cbo.setIsLastV(true);
                cbo.setIsFirstV(false);
                //升版的时候,生命周期的状态需要改动到默认状态
                if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){
                    //查询生命周期
                    OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId());
                    if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.getOid())){
//                    OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId());
                    LifeCycle lifeCycleVO = null;
                    try {
                        lifeCycleVO = ServiceProvider.getOMDService().getLifeCycleService().getLifeCycle(btmTypeVO.getLifeCycleId());
                    } catch (VCIError e) {
                        throw new RuntimeException(e);
                    }
                    if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.oid)){
                        throw new VciBaseException("{0}里的生命周期设置得不正确,在系统中没有找到{1}这个生命周期",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()});
                    }
                    cbo.setLcStatus(lifeCycleVO.getStartStatus());
                    cbo.setLcStatus(lifeCycleVO.startState);
                }
            }
        }else{
@@ -1994,13 +2018,13 @@
            if(StringUtils.isBlank(cbo.getCreator())){
                cbo.setCreator(VciBaseUtil.getCurrentUserId());
            }
            if(StringUtils.isBlank(cbo.getCreateTime())){
                cbo.setCreateTime(VciDateUtil.getNowString());
            if(cbo.getCreateTime() != 0){
                cbo.setCreateTime(System.currentTimeMillis());
            }
            if(StringUtils.isBlank(cbo.getOwner())){
                cbo.setOwner(cbo.getCreator());
            }
            cbo.setTs(VciDateUtil.getNowString());
            cbo.setTs(System.currentTimeMillis());
            if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId()) && (StringUtils.isBlank(cbo.getLcStatus()) || newRevision || newVersion)){
                //查询生命周期
                OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId());
@@ -2031,17 +2055,17 @@
                if (StringUtils.isBlank(cbo.getRevisionid())) {
                    cbo.setRevisionid(VciBaseUtil.getPk());
                }
                cbo.setIsFirstR(1);
                cbo.setIsLastR(1);
                cbo.setIsFirstR(true);
                cbo.setIsLastR(true);
                cbo.setRevisionRule(btmTypeVO.getRevisionRuleId());
                cbo.setRevisionSeq(0);
                cbo.setRevisionSeq((short) 0);
                //看看是否需要处理版次
                cbo.setVersionValue(getFirstVersion(btmTypeVO.getVersionRule()));
                cbo.setVersionRule(btmTypeVO.getVersionRule());
                cbo.setVersionSeq(0);
                cbo.setIsLastV(1);
                cbo.setIsFirstV(1);
                cbo.setVersionSeq((short) 0);
                cbo.setIsLastV(true);
                cbo.setIsFirstV(true);
            }
        }
        setValueToCbo(dataLowMap,baseDataMap,cbo,editFlag);
@@ -2075,7 +2099,7 @@
     * @param editFlag 是否为编辑
     */
    @Override
    public void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, ClientBusinessObject cbo, boolean editFlag){
    public void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, com.vci.client.bof.ClientBusinessObject cbo, boolean editFlag){
        dataLow.forEach((key,value)->{
            if(editFlag&&notSendOnEdit(key)){
                //平台不能传递这个
@@ -2141,7 +2165,7 @@
            //说明前置事件没有执行成功
            return beforeResult;
        }
        ClientLinkObject clo = null;
        com.vci.client.bof.ClientLinkObject 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();
@@ -2159,10 +2183,10 @@
                }
            });
        }
        ClientBusinessObject toCbo =null;
        com.vci.client.bof.ClientBusinessObject toCbo =null;
        if(!CollectionUtils.isEmpty(boData)) {
            //封装to端的
            BaseResult<ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO, formDefineVO, toOid, toBtmName, boData);
            BaseResult<com.vci.client.bof.ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO, formDefineVO, toOid, toBtmName, boData);
            if (!result.isSuccess()) {
                return BaseResult.fail(result.getMsg(), result.getMsgObjs());
            }
@@ -2170,7 +2194,7 @@
        }
        //初始化链接类型的值
        BaseResult<ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, true);
        BaseResult<com.vci.client.bof.ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, true);
        if(!resultClo.isSuccess()){
            return BaseResult.fail(resultClo.getMsg(),resultClo.getMsgObjs());
        }
@@ -2182,19 +2206,21 @@
                clo.setToBO(toCbo);
            }
        }
        LinkObjectHolder loHolder = new LinkObjectHolder();
        loHolder.value = clo.getLinkObject();
//        LinkObjectHolder loHolder = new LinkObjectHolder();
//        loHolder.value = clo.getLinkObject();
        try {
            platformClientUtil.getBOFactoryService().updateLinkObject(loHolder);
//            platformClientUtil.getBOFactoryService().updateLinkObject(loHolder);
            ServiceProvider.getBOFService().updateLinkObject(clo.getLinkObject());
        } catch (VCIError vciError) {
            throw WebUtil.getVciBaseException(vciError);
        }
        //保存to端或者from端
        BusinessObjectHolder boHolder = new BusinessObjectHolder();
        toCbo.dealBusinessObjectNullValue();
        boHolder.value = toCbo.getBusinessObject();
//        toCbo.dealBusinessObjectNullValue();
//        boHolder.value = toCbo.getBusinessObject();
        try{
            platformClientUtil.getBOFactoryService().updateBusinessObject(boHolder);
//            platformClientUtil.getBOFactoryService().updateBusinessObject(boHolder);
            ServiceProvider.getBOFService().updateBusinessObject(toCbo.getBusinessObject());
        } catch (VCIError vciError) {
            throw WebUtil.getVciBaseException(vciError);
        }
@@ -2204,7 +2230,7 @@
        //后置事件
        String afterEvent = formLinkDataDTO.getPostEvent();
        try {
            callPostEvent(null,Arrays.stream(new ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD);
            callPostEvent(null,Arrays.stream(new com.vci.client.bof.ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD);
        }catch (Throwable e){
            //后置事件有问题了就只能是这样了,没办法恢复
            throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e);
@@ -2239,17 +2265,17 @@
        }
        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<ClientBusinessObject>> fromBtmDataGroups = new HashMap<>();
        Map<String,List<ClientBusinessObject>> toBtmDataGroups = new HashMap<>();
        Map<String,List<com.vci.client.bof.ClientBusinessObject>> fromBtmDataGroups = new HashMap<>();
        Map<String,List<com.vci.client.bof.ClientBusinessObject>> toBtmDataGroups = new HashMap<>();
        if(!CollectionUtils.isEmpty(fromBtmGroups)){
            fromBtmGroups.forEach((btmType,cloList)->{
                List<ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getFromOid).collect(Collectors.toList()), btmType);
                List<com.vci.client.bof.ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getFromOid).collect(Collectors.toList()), btmType);
                fromBtmDataGroups.put(btmType,cbos);
            });
        }
        if(!CollectionUtils.isEmpty(toBtmGroups)){
            toBtmGroups.forEach((btmType,cloList)->{
                List<ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getToOid).collect(Collectors.toList()), btmType);
                List<com.vci.client.bof.ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getToOid).collect(Collectors.toList()), btmType);
                toBtmDataGroups.put(btmType,cbos);
            });
        }
@@ -2295,7 +2321,7 @@
        if(deleteLinkDataDTO.isDeleteFromData()){
            fromBtmDataGroups.forEach((btm,cbos)->{
                try{
                    platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1);
                    platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1);
                }catch (VCIError vciError) {
                    throw WebUtil.getVciBaseException(vciError);
                }
@@ -2304,7 +2330,7 @@
        if(deleteLinkDataDTO.isDeleteToData()){
            toBtmDataGroups.forEach((btm,cbos)->{
                try{
                    platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1);
                    platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1);
                }catch (VCIError vciError) {
                    throw WebUtil.getVciBaseException(vciError);
                }
@@ -2378,7 +2404,7 @@
            referConfigVO.setConditionMap(new HashMap<>());
        }
        List<ClientBusinessObject> cbos = null;
        List<com.vci.client.bof.ClientBusinessObject> cbos = null;
        String oidFieldName = StringUtils.isNotBlank(referConfigVO.getParentUsedField())?referConfigVO.getParentUsedField():referConfigVO.getValueField();
        if(referConfigVO.isSelectAllLevel()) {
            String parentOidSql = "";
@@ -2453,7 +2479,7 @@
    @Override
    public List<Map<String,String>> getDataAttr(String btmname, String oid) {
        VciBaseUtil.alertNotNull(btmname,"业务类型的信息",oid,"业务数据的主键");
        List<ClientBusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid));
        List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid));
        List<Map<String,String>> dataMap = new ArrayList<>();
        if(!CollectionUtils.isEmpty(cbos)){
            cbos.stream().forEach(cbo->{