| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.bof.RevisionValueObject; |
| | | import com.vci.client.bof.VersionValueObject; |
| | | import com.vci.client.common.providers.ServiceProvider; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.common.VCIError; |
| | | import com.vci.corba.omd.data.*; |
| | | import com.vci.corba.omd.lcm.LifeCycle; |
| | | import com.vci.file.pagemodel.VciFileObjectVO; |
| | | import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; |
| | | import com.vci.frameworkcore.lcstatuspck.ReleaseDataLCStatus; |
| | | import com.vci.omd.constants.SystemAttribute; |
| | | import com.vci.starter.revision.bo.TreeWrapperOptions; |
| | | import com.vci.starter.web.annotation.bus.VciChangeDataAfter; |
| | | import com.vci.starter.web.annotation.bus.VciChangeDataBefore; |
| | |
| | | import com.vci.starter.web.util.*; |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import com.vci.web.dto.*; |
| | | import com.vci.web.enumpck.UIComponentTypeEnum; |
| | | import com.vci.web.enumpck.UIFieldTypeEnum; |
| | | import com.vci.web.enumpck.UITreeLoadTypeEnum; |
| | | import com.vci.web.model.BaseLinkModel; |
| | | import com.vci.web.pageModel.*; |
| | | import com.vci.web.query.UIDataGridQuery; |
| | | import com.vci.web.query.UIFormQuery; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import plm.bs.bom.clientobject.*; |
| | | import plm.bs.bom.common.*; |
| | | import plm.corba.qt.BOAndLO; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.*; |
| | |
| | | com.vci.client.bof.ClientBusinessObject afterCBO = null; |
| | | try { |
| | | // 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); |
| | | com.vci.corba.omd.data.BusinessObject resultBO = ServiceProvider.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false); |
| | | // BusinessObject resultBO = ServiceProvider.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false); |
| | | 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)); |
| | |
| | | baseModel.setRevisionValue(""); |
| | | } |
| | | return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextRevisionValueObject(WebUtil.getTableName(btmTypeVO.getId()),baseModel.getNameOid(),btmTypeVO.getRevisionRuleId(),btmTypeVO.isInputRevisionFlag(),baseModel.getRevisionValue())); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | * @return 版本的值对象 |
| | | */ |
| | | @Override |
| | | public VersionValueObject getNextVersion(OsBtmTypeVO btmTypeVO,BaseModel baseModel){ |
| | | public VersionValueObject getNextVersion(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ |
| | | try{ |
| | | return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextVersionValue(WebUtil.getTableName(btmTypeVO.getId()),baseModel.getRevisionOid(),baseModel.getNameOid(),WebUtil.getInt(btmTypeVO.getVersionRule()))); |
| | | }catch (VCIError vciError){ |
| | | }catch (PLException vciError){ |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | return beforeResult; |
| | | } |
| | | //封装数据 |
| | | List<com.vci.corba.omd.data.BusinessObject> addBos = new ArrayList<>(); |
| | | List<com.vci.corba.omd.data.BusinessObject> afterBOs = new ArrayList<>(); |
| | | List<BusinessObject> addBos = new ArrayList<>(); |
| | | List<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()) { |
| | |
| | | } |
| | | } |
| | | try { |
| | | // 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); |
| | | // BusinessObject[] resultBOs = platformClientUtil.getBOFactoryService().batchCreateBusinessObject(addBos.toArray(new BusinessObject[0]), false, false); |
| | | BusinessObject[] resultBOs = ServiceProvider.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(); |
| | |
| | | //说明后置事件出现了错误,那么就需要删除以前的这条数据 |
| | | try { |
| | | platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(afterBOs.toArray(new BusinessObject[0]),1); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); |
| | |
| | | BaseResult<Map<String,Object>> result = BaseResult.success(); |
| | | try { |
| | | // 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()); |
| | | 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)); |
| | |
| | | return beforeResult; |
| | | } |
| | | //封装数据 |
| | | List<com.vci.corba.omd.data.BusinessObject> updateCBOS = new ArrayList<>(); |
| | | List<BusinessObject> updateCBOS = new ArrayList<>(); |
| | | Map<String,List<String>> releasedFileOids = new HashMap<>(); |
| | | List<com.vci.client.bof.ClientBusinessObject> afterCBOs = new ArrayList<>(); |
| | | for(FormDataDTO formDataDTO:formDataDTOList.getFormDataDTOS()) { |
| | |
| | | } |
| | | } |
| | | try { |
| | | platformClientUtil.getBOFactoryService().batchUpdateBusinessObject(new BusinessObjectListHolder(updateCBOS.toArray(new BusinessObject[0]))); |
| | | } catch (VCIError vciError) { |
| | | platformClientUtil.getBOFactoryService().batchUpdateBusinessObject(updateCBOS.toArray(new BusinessObject[updateCBOS.size()])); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | if(!CollectionUtils.isEmpty(releasedFileOids)){ |
| | |
| | | VciBaseUtil.switchCollectionForOracleIn(finalCbo).stream().forEach(cbos->{ |
| | | try { |
| | | // platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(s->s.getBusinessObject()).collect(Collectors.toList()).toArray(new BusinessObject[0]),1); |
| | | ServiceProvider.getBOFService().batchDeleteBusinessObject(cbos.stream().map(s->s.getBusinessObject()).collect(Collectors.toList()).toArray(new com.vci.corba.omd.data.BusinessObject[0]),1); |
| | | ServiceProvider.getBOFService().batchDeleteBusinessObject(cbos.stream().map(s->s.getBusinessObject()).collect(Collectors.toList()).toArray(new BusinessObject[0]),1); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | clo.setToBO(toCbo); |
| | | } |
| | | //执行保存 |
| | | com.vci.corba.omd.data.BusinessObject[] bos = new com.vci.corba.omd.data.BusinessObject[1]; |
| | | BusinessObject[] bos = new BusinessObject[1]; |
| | | toCbo.dealBusinessObjectNullValue(); |
| | | clo.dealLinkObjectNullValue(); |
| | | bos[0] = toCbo.getBusinessObject(); |
| | |
| | | return result; |
| | | } |
| | | //处理业务类型得到数据 |
| | | com.vci.client.bof.ClientLinkObject clo ; |
| | | ClientLinkObject clo ; |
| | | if(editFlag){ |
| | | try { |
| | | // 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(); |
| | | LinkObject linkObject = ServiceProvider.getBOFService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType()); |
| | | clo = new ClientLinkObject(); |
| | | clo.setLinkObject(linkObject); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | }else{ |
| | | clo = new com.vci.client.bof.ClientLinkObject(); |
| | | clo = new ClientLinkObject(); |
| | | //处理初始化的数据 |
| | | clo.setOid(VciBaseUtil.getPk()); |
| | | clo.setCreator(VciBaseUtil.getCurrentUserId()); |
| | |
| | | }); |
| | | try { |
| | | platformClientUtil.getBOFactoryService().batchDeleteLinkObject(los.toArray(new LinkObject[0])); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | if(deleteLinkDataDTO.isDeleteFromData()){ |
| | | fromBtmDataGroups.forEach((btm,cbos)->{ |
| | | try{ |
| | | platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1); |
| | | }catch (VCIError vciError) { |
| | | }catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | }); |
| | |
| | | toBtmDataGroups.forEach((btm,cbos)->{ |
| | | try{ |
| | | platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1); |
| | | }catch (VCIError vciError) { |
| | | }catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | }); |