| | |
| | | import com.vci.corba.omd.qtm.QTInfo; |
| | | import com.vci.corba.query.ObjectQueryService; |
| | | import com.vci.corba.query.ObjectQueryServicePrx; |
| | | import com.vci.corba.query.data.KV; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.mw.client.InvocationUtility; |
| | | import com.vci.starter.web.annotation.Column; |
| | |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | | import com.vci.starter.web.util.BeanUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import com.vci.web.pageModel.*; |
| | | import com.vci.web.properties.WebProperties; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.DocumentHelper; |
| | | import org.omg.CORBA.IntHolder; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import plm.bs.bom.clientobject.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import plm.bs.bom.clientobject.ClientLinkObject; |
| | | import plm.bs.bom.common.*; |
| | | import plm.corba.qt.KV; |
| | | import plm.corba.qt.QTServiceOperations; |
| | | import plm.oq.objectQuery.common.*; |
| | | |
| | | import java.lang.reflect.Field; |
| | |
| | | bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setNameoid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setBtmName(boName); |
| | | bo.setIsLastR(1); |
| | | bo.setIsFirstR(1); |
| | | bo.setIsFirstV(1); |
| | | bo.setIsLastV(1); |
| | | bo.setIsLastR(true); |
| | | bo.setIsFirstR(true); |
| | | bo.setIsFirstV(true); |
| | | bo.setIsLastV(true); |
| | | bo.setCreator(userName); |
| | | bo.setCreateTime(String.valueOf(System.currentTimeMillis())); |
| | | bo.setCreateTime(System.currentTimeMillis()); |
| | | bo.setLastModifier(userName); |
| | | bo.setLastModifyTime(String.valueOf(System.currentTimeMillis())); |
| | | bo.setLastModifyTime(System.currentTimeMillis()); |
| | | bo.setRevisionRule(btmTypeVO.getRevisionRuleId()); |
| | | bo.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){ |
| | |
| | | bo.setRevisionValue(revisionRuleVO.getStartCode()); |
| | | } |
| | | |
| | | bo.setRevisionSeq(1); |
| | | bo.setVersionSeq(1); |
| | | bo.setRevisionSeq((short) 1); |
| | | bo.setVersionSeq((short) 1); |
| | | bo.setVersionValue(getVersionValue(WebUtil.getInt(btmTypeVO.getVersionRule()))); |
| | | bo.setLctId(btmTypeVO.getLifeCycleId()); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ |
| | |
| | | bo.setName(""); |
| | | bo.setDescription(""); |
| | | bo.setOwner(userName); |
| | | bo.setCheckinBy(userName); |
| | | // bo.setCheckinBy(userName); |
| | | bo.setCopyFromVersion(""); |
| | | this.initTypeAttributeValue(bo,btmTypeVO); |
| | | return bo; |
| | |
| | | */ |
| | | private ClientBusinessObject cloneClientBusinessObject(ClientBusinessObject cbo){ |
| | | if(cbo !=null){ |
| | | BusinessObject businessObject = new BusinessObject(); |
| | | BusinessObject bo = cbo.getBusinessObject(); |
| | | com.vci.corba.omd.data.BusinessObject businessObject = new com.vci.corba.omd.data.BusinessObject(); |
| | | com.vci.corba.omd.data.BusinessObject bo = cbo.getBusinessObject(); |
| | | businessObject.oid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.revisionid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.nameoid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.btmName = bo.btmName; |
| | | businessObject.btName = bo.btName; |
| | | businessObject.isLastR = bo.isLastR; |
| | | businessObject.isFirstR = bo.isFirstR; |
| | | businessObject.isLastV = bo.isLastV; |
| | | businessObject.isFirstV = bo.isFirstV; |
| | | businessObject.creator = WebUtil.getCurrentUserId(); |
| | | businessObject.createTime = String.valueOf(System.currentTimeMillis()); |
| | | businessObject.lastModifier = bo.lastModifier; |
| | | businessObject.lastModifyTime = String.valueOf(bo.lastModifyTime); |
| | | businessObject.createTime = System.currentTimeMillis(); |
| | | businessObject.modifier = bo.modifier; |
| | | businessObject.modifyTime = bo.modifyTime; |
| | | businessObject.revisionRule = bo.revisionRule; |
| | | businessObject.versionRule = bo.versionRule; |
| | | businessObject.revisionSeq = bo.revisionSeq; |
| | |
| | | businessObject.versionValue = bo.versionValue; |
| | | businessObject.lctId = bo.lctId; |
| | | businessObject.lcStatus = bo.lcStatus; |
| | | businessObject.ts = VciDateUtil.getNowString(); |
| | | businessObject.ts = System.currentTimeMillis(); |
| | | businessObject.id = bo.id; |
| | | businessObject.name = bo.name; |
| | | businessObject.description = bo.description; |
| | | businessObject.owner = businessObject.creator; |
| | | businessObject.checkinBy = bo.checkinBy; |
| | | businessObject.checkinTime = bo.checkinTime; |
| | | businessObject.checkoutBy = bo.checkoutBy; |
| | | businessObject.checkoutTime = bo.checkoutTime; |
| | | businessObject.copyFromVersion = bo.copyFromVersion; |
| | | // businessObject.checkinBy = bo.checkinBy; |
| | | // businessObject.checkinTime = bo.checkinTime; |
| | | // businessObject.checkoutBy = bo.checkoutBy; |
| | | // businessObject.checkoutTime = bo.checkoutTime; |
| | | businessObject.fromVersion = bo.fromVersion; |
| | | if(bo.newAttrValList !=null){ |
| | | businessObject.newAttrValList = clone(bo.newAttrValList); |
| | | } |
| | |
| | | * @param newAttrValList 属性值对象数组 |
| | | * @return 拷贝后的新属性数组 |
| | | */ |
| | | private AttributeValue[] clone(AttributeValue[] newAttrValList) { |
| | | AttributeValue[] n = new AttributeValue[newAttrValList.length]; |
| | | private com.vci.corba.omd.data.AttributeValue[] clone(com.vci.corba.omd.data.AttributeValue[] newAttrValList) { |
| | | com.vci.corba.omd.data.AttributeValue[] n = new com.vci.corba.omd.data.AttributeValue[newAttrValList.length]; |
| | | for (int i = 0; i < newAttrValList.length; i++) { |
| | | n[i] = new AttributeValue(newAttrValList[i].attrName,newAttrValList[i].attrVal); |
| | | n[i] = new com.vci.corba.omd.data.AttributeValue(newAttrValList[i].attrName,newAttrValList[i].attrVal); |
| | | } |
| | | return n; |
| | | } |
| | |
| | | String fieldName = referInfo.split("\\.")[1].trim().toLowerCase(); |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put(fieldName,QueryOptionConstant.IN + "(" + WebUtil.toInSql(value.toArray(new String[0])) + ")"); |
| | | List<ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null, Arrays.asList(new String[]{"oid",fieldName})); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null, Arrays.asList(new String[]{"oid",fieldName})); |
| | | |
| | | Map<String,String> data = new HashMap<String, String>(); |
| | | if(cbos!=null && cbos.size() > 0){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | for(com.vci.client.bof.ClientBusinessObject cbo : cbos){ |
| | | data.put(cbo.getAttributeValue(fieldName),cbo.getOid()); |
| | | } |
| | | } |
| | |
| | | throw new VciBaseException("属性" + columnName + "的值为空"); |
| | | } |
| | | conditionMap.put(columnName,QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oidSet.toArray(new String[0])) + ")"); |
| | | List<ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); |
| | | if(cbos !=null && cbos.size() >0){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | for(com.vci.client.bof.ClientBusinessObject cbo : cbos){ |
| | | String oid = cbo.getAttributeValue(columnName); |
| | | if(oidSet.contains(oid)){ |
| | | oidSet.remove(oid); |
| | |
| | | * @throws VciBaseException 查询出错的是抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBO(String btmType, |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, |
| | | Map<String, String> conditionMap) throws VciBaseException { |
| | | List<String> clauseList = new ArrayList<String>(); |
| | | clauseList.add("*"); |
| | |
| | | * @throws VciBaseException 查询出错的是抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBO(String btmType, |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, |
| | | Map<String, String> conditionMap, PageHelper ph) |
| | | throws VciBaseException { |
| | | List<String> clauseList = new ArrayList<String>(); |
| | |
| | | * @throws VciBaseException 查询出错的是抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBO(String btmType, |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, |
| | | Map<String, String> conditionMap, PageHelper ph, |
| | | List<String> clauseList) throws VciBaseException { |
| | | QueryTemplate qt = new QueryTemplate(); |
| | |
| | | * @return 查询出来的值 |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | private List<ClientBusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ |
| | | List<ClientBusinessObject> allCbos = new ArrayList<ClientBusinessObject>(); |
| | | private List<com.vci.client.bof.ClientBusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ |
| | | List<com.vci.client.bof.ClientBusinessObject> allCbos = new ArrayList<com.vci.client.bof.ClientBusinessObject>(); |
| | | if(clauseList == null){ |
| | | clauseList = new ArrayList<String>(); |
| | | clauseList.add("*"); |
| | |
| | | } |
| | | if (bos != null && bos.count > 0) { |
| | | for (com.vci.corba.omd.data.BusinessObject bo : bos.returnValue) { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | BusinessObject businessObject = Func.copyProperties(bo, BusinessObject.class); |
| | | cbo.setBusinessObject(businessObject); |
| | | com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); |
| | | // BusinessObject businessObject = new BusinessObject(bo.oid, bo.revisionid, bo.nameoid, bo.btName, bo.isLastR ? 1 : 0, bo.isFirstR ? 1 : 0, |
| | | // bo.isLastV ? 1 : 0, bo.isFirstV ? 1 : 0, bo.creator, String.valueOf(bo.createTime), bo.modifier, String.valueOf(bo.modifyTime), |
| | | // bo.revisionRule, bo.versionRule, bo.revisionSeq, bo.revisionValue, bo.versionSeq, |
| | | // bo.versionValue, bo.lctId, bo.lcStatus, String.valueOf(bo.ts), bo.id, bo.name, bo.description, |
| | | // bo.owner,null, null, null, null, |
| | | // bo.fromVersion, copyToAttributeValue(bo.newAttrValList), copyToAttributeValue(bo.hisAttrValList)); |
| | | cbo.setBusinessObject(bo); |
| | | queryEnumText(cbo,enumAttrName); |
| | | allCbos.add(cbo); |
| | | } |
| | |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | return allCbos; |
| | | } |
| | | |
| | | public AttributeValue[] copyToAttributeValue(com.vci.corba.omd.data.AttributeValue[] attributeValues){ |
| | | AttributeValue[] attributeValueList = new AttributeValue[attributeValues.length]; |
| | | for (int i = 0; i < attributeValues.length; i++) { |
| | | AttributeValue newAttributeValue = new AttributeValue(); |
| | | newAttributeValue.attrName = attributeValues[i].attrName; |
| | | newAttributeValue.attrVal = attributeValues[i].attrVal; |
| | | attributeValueList[i] = newAttributeValue; |
| | | } |
| | | return attributeValueList; |
| | | } |
| | | |
| | | /** |
| | |
| | | * 查询生命周期的值 |
| | | * @param cbos 业务对象 |
| | | */ |
| | | private void queryLcStatus(List<ClientBusinessObject> cbos){ |
| | | private void queryLcStatus(List<com.vci.client.bof.ClientBusinessObject> cbos){ |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | |
| | | Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap(); |
| | |
| | | * @param enumAttrName 枚举属性的值 |
| | | * @throws VciBaseException |
| | | */ |
| | | private void queryEnumText(ClientBusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ |
| | | private void queryEnumText(com.vci.client.bof.ClientBusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ |
| | | queryEnumText(cbo,null,enumAttrName); |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException 查询枚举出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public void queryEnumText(ClientBusinessObject cbo, ClientLinkObject clo, List<String> enumAttrName) throws VciBaseException{ |
| | | public void queryEnumText(com.vci.client.bof.ClientBusinessObject cbo, com.vci.client.bof.ClientLinkObject clo, List<String> enumAttrName) throws VciBaseException{ |
| | | if(enumAttrName.size()>0){//查询枚举 |
| | | for(String enumAttr:enumAttrName){//格式为 code_field code是枚举的编码,field是当前业务类型存储枚举值的字段 |
| | | if(enumAttr.toLowerCase().equals("creator_name")){ |
| | |
| | | * @param attr 属性名 |
| | | * @param value 值 |
| | | */ |
| | | private void setValueToCboOrClo(ClientBusinessObject cbo,ClientLinkObject clo,String attr,String value){ |
| | | private void setValueToCboOrClo(com.vci.client.bof.ClientBusinessObject cbo,com.vci.client.bof.ClientLinkObject clo,String attr,String value){ |
| | | try { |
| | | if (cbo != null) { |
| | | cbo.setAttributeValueWithNoCheck(attr, value); |
| | |
| | | * @param attributeValue 属性的值 |
| | | */ |
| | | @Override |
| | | public void setAttributeValueForClo(ClientLinkObject clo, String attributeName, String attributeValue) { |
| | | AttributeValue[] attrValues = clo.getLinkObject().newAttrValList; |
| | | ArrayList<AttributeValue> attrValList = new ArrayList(); |
| | | AttributeValue attrVal; |
| | | public void setAttributeValueForClo(com.vci.client.bof.ClientLinkObject clo, String attributeName, String attributeValue) { |
| | | com.vci.corba.omd.data.AttributeValue[] attrValues = clo.getLinkObject().newAttrValList; |
| | | ArrayList<com.vci.corba.omd.data.AttributeValue> attrValList = new ArrayList(); |
| | | com.vci.corba.omd.data.AttributeValue attrVal; |
| | | int i; |
| | | if (attrValues != null && attrValues.length > 0) { |
| | | AttributeValue[] var9 = attrValues; |
| | | com.vci.corba.omd.data.AttributeValue[] var9 = attrValues; |
| | | i = attrValues.length; |
| | | |
| | | for (int var7 = 0; var7 < i; ++var7) { |
| | |
| | | boolean isExist = false; |
| | | |
| | | for (i = 0; i < attrValList.size(); ++i) { |
| | | attrVal = (AttributeValue) attrValList.get(i); |
| | | attrVal = (com.vci.corba.omd.data.AttributeValue) attrValList.get(i); |
| | | if (attrVal.attrName.toUpperCase().equals(attributeName.toUpperCase())) { |
| | | attrVal.attrVal = attributeValue; |
| | | isExist = true; |
| | |
| | | } |
| | | |
| | | if (!isExist) { |
| | | attrVal = new AttributeValue(); |
| | | attrVal = new com.vci.corba.omd.data.AttributeValue(); |
| | | attrVal.attrName = attributeName.toUpperCase(); |
| | | attrVal.attrVal = attributeValue; |
| | | attrValList.add(attrVal); |
| | | } |
| | | |
| | | clo.getLinkObject().newAttrValList = (AttributeValue[]) attrValList.toArray(new AttributeValue[attrValList.size()]); |
| | | clo.getLinkObject().newAttrValList = (com.vci.corba.omd.data.AttributeValue[]) attrValList.toArray(new com.vci.corba.omd.data.AttributeValue[attrValList.size()]); |
| | | } |
| | | |
| | | |
| | |
| | | * @param enumAttrName 枚举属性 |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | private void queryEnumTextClo(ClientLinkObject clo,List<String> enumAttrName) throws VciBaseException{ |
| | | private void queryEnumTextClo(com.vci.client.bof.ClientLinkObject clo,List<String> enumAttrName) throws VciBaseException{ |
| | | queryEnumText(null,clo,enumAttrName); |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap) |
| | | throws VciBaseException { |
| | | PageHelper ph = new PageHelper(-1); |
| | |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | PageHelper ph) throws VciBaseException { |
| | | List<String> clauseList = new ArrayList<String>(); |
| | |
| | | * @throws VciBaseException 查询出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | PageHelper ph, List<String> clauseList) throws VciBaseException { |
| | | QueryTemplate qt = getQtByName(queryScheme,replaceMap); |
| | |
| | | } |
| | | int count = 0; |
| | | try{ |
| | | count = platformClientUtil.getQueryService().findTotalCount(qt.getId(), Tool.qtTOXMl(qt).asXML()); |
| | | // count = platformClientUtil.getQueryService().findTotalCount(); |
| | | count = Integer.parseInt(String.valueOf(ServiceProvider.getOQService().findTotalCount(qt.getId(), Tool.qtTOXMl(qt).asXML()))); |
| | | }catch (VCIError e) { |
| | | try { |
| | | count = platformClientUtil.getQueryService().findTotalCount(qt.getId(), Tool.qtTOXMl(qt).asXML()); |
| | | // count = platformClientUtil.getQueryService().findTotalCount(qt.getId(), Tool.qtTOXMl(qt).asXML()); |
| | | count = Integer.parseInt(String.valueOf(ServiceProvider.getOQService().findTotalCount(qt.getId(), Tool.qtTOXMl(qt).asXML()))); |
| | | }catch (VCIError ee) { |
| | | // logger.error(ee.error_code,ee); |
| | | // throw WebUtil.getVciBaseException(ee); |
| | |
| | | * @throws VciBaseException 查询出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryBySql(String sql, |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryBySql(String sql, |
| | | Map<String, String> conditionMap) throws VciBaseException { |
| | | List<Map> allData = queryBySqlForMap(sql,conditionMap); |
| | | if(allData == null || allData.size() == 0){ |
| | | return new ArrayList<ClientBusinessObject>(); |
| | | return new ArrayList<com.vci.client.bof.ClientBusinessObject>(); |
| | | }else{ |
| | | return map2Cbos(allData); |
| | | } |
| | |
| | | * @throws VciBaseException 查询出错活抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException{ |
| | | public List<com.vci.client.bof.ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException{ |
| | | List<Map> allData = queryByOnlySqlForMap(sql); |
| | | if(allData == null || allData.size() == 0){ |
| | | return new ArrayList<ClientBusinessObject>(); |
| | | return new ArrayList<com.vci.client.bof.ClientBusinessObject>(); |
| | | }else{ |
| | | return map2Cbos(allData); |
| | | } |
| | |
| | | } |
| | | List<Map> dataList = new ArrayList<>(); |
| | | try { |
| | | KV[][] kvs = platformClientUtil.getQueryService().queryBySql(sql); |
| | | // KV[][] kvs = platformClientUtil.getQueryService().queryBySql(sql); |
| | | com.vci.corba.query.data.KV[][] kvs = ServiceProvider.getOQService().queryBySql(sql); |
| | | if(kvs!=null && kvs.length>0){ |
| | | for (int i = 0; i < kvs.length; i++) { |
| | | Map<String,String> data = new HashMap<>(); |
| | | KV[] kv = kvs[i]; |
| | | com.vci.corba.query.data.KV[] kv = kvs[i]; |
| | | if(kv!=null && kv.length >0){ |
| | | for (int j = 0; j < kv.length; j++) { |
| | | KV kv1 = kv[j]; |
| | |
| | | allFieldAttrMap.put(columnName.toLowerCase(),fieldName); |
| | | } |
| | | List<T> allObject = new ArrayList<T>(); |
| | | List<ClientBusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//执行查询 |
| | | List<com.vci.client.bof.ClientBusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//执行查询 |
| | | List<String> oids = new ArrayList<String>(); |
| | | |
| | | if(allCbos!=null&&allCbos.size()>0){ |
| | | for(ClientBusinessObject cbo : allCbos){ |
| | | for(com.vci.client.bof.ClientBusinessObject cbo : allCbos){ |
| | | T obj = null; |
| | | try { |
| | | obj = c.newInstance(); |
| | |
| | | allFieldAttrMap.put(columnName.toLowerCase(),fieldName); |
| | | } |
| | | List<T> allObject = new ArrayList<T>(); |
| | | List<ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); |
| | | List<com.vci.client.bof.ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); |
| | | List<String> oids = new ArrayList<String>(); |
| | | if(allCbos!=null&&allCbos.size()>0){ |
| | | for(ClientBusinessObject cbo : allCbos){ |
| | | for(com.vci.client.bof.ClientBusinessObject cbo : allCbos){ |
| | | T obj = null; |
| | | try { |
| | | obj = c.newInstance(); |
| | |
| | | * @param isEdit 是否为编辑 |
| | | * @throws VciBaseException 设置出错会抛出异常 |
| | | */ |
| | | private void setValueToCbo(Object obj,String btmType,ClientBusinessObject cbo ,boolean isEdit) throws VciBaseException{ |
| | | private void setValueToCbo(Object obj,String btmType,com.vci.client.bof.ClientBusinessObject cbo ,boolean isEdit) throws VciBaseException{ |
| | | Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); |
| | | if(pkField == null){ |
| | | throw new VciBaseException("{0}类中没有定义主键属性",new Object[]{obj.getClass()}); |
| | |
| | | if(list==null){ |
| | | throw new VciBaseException(VciBaseException.paramNull); |
| | | } |
| | | Set<ClientBusinessObject> allUpdateCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<ClientBusinessObject> allAddCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<com.vci.client.bof.ClientBusinessObject> allUpdateCbos = new HashSet<com.vci.client.bof.ClientBusinessObject>(); |
| | | Set<com.vci.client.bof.ClientBusinessObject> allDeleteCbos = new HashSet<com.vci.client.bof.ClientBusinessObject>(); |
| | | Set<com.vci.client.bof.ClientBusinessObject> allAddCbos = new HashSet<com.vci.client.bof.ClientBusinessObject>(); |
| | | Map<String,String> btmOidsMap = new HashMap<String, String>(); |
| | | for(T obj : list){ |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | |
| | | } |
| | | btmOidsMap.put(btmType, tempOids); |
| | | } |
| | | List<ClientBusinessObject> needUpdateCbos = new ArrayList<ClientBusinessObject>(); |
| | | List<com.vci.client.bof.ClientBusinessObject> needUpdateCbos = new ArrayList<com.vci.client.bof.ClientBusinessObject>(); |
| | | Iterator<String> it = btmOidsMap.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | | String btmType = it.next(); |
| | |
| | | } |
| | | //主键 |
| | | Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); |
| | | ClientBusinessObject cbo = null; |
| | | com.vci.client.bof.ClientBusinessObject cbo = null; |
| | | if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ |
| | | continue; |
| | | }else{ |
| | | for(ClientBusinessObject tempCbo : needUpdateCbos){ |
| | | for(com.vci.client.bof.ClientBusinessObject tempCbo : needUpdateCbos){ |
| | | if(tempCbo.getOid().equalsIgnoreCase(pkValue.toString().trim())){ |
| | | cbo = tempCbo; |
| | | break; |
| | |
| | | } |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | | //拷贝之前先清除已经有的值 |
| | | cbo.getBusinessObject().newAttrValList = new AttributeValue[0]; |
| | | cbo.getBusinessObject().newAttrValList = new com.vci.corba.omd.data.AttributeValue[0]; |
| | | setValueToCbo(obj,btmType,cbo,true); |
| | | allUpdateCbos.add(cbo); |
| | | } |
| | |
| | | if(ts.contains(".")){ |
| | | ts = ts.substring(0,ts.lastIndexOf(".")); |
| | | } |
| | | return cbos.get(0).getTs().contains(ts); |
| | | return cbos.get(0).getTs() == Long.valueOf(ts); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @throws VciBaseException 转换出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public Map cbo2Map(ClientBusinessObject cbo) throws VciBaseException { |
| | | public Map cbo2Map(com.vci.client.bof.ClientBusinessObject cbo) throws VciBaseException { |
| | | Map<String,String> map = new HashMap<String, String>(); |
| | | WebUtil.copyValueToMapFromCbos(cbo, map); |
| | | return map; |
| | |
| | | * @throws VciBaseException 转换出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> map2Cbos(List<Map> mapList) |
| | | public List<com.vci.client.bof.ClientBusinessObject> map2Cbos(List<Map> mapList) |
| | | throws VciBaseException { |
| | | List<ClientBusinessObject> cboList = new ArrayList<ClientBusinessObject>(); |
| | | List<com.vci.client.bof.ClientBusinessObject> cboList = new ArrayList<com.vci.client.bof.ClientBusinessObject>(); |
| | | for(Map map : mapList){ |
| | | cboList.add(map2Cbo(map)); |
| | | } |
| | |
| | | * @throws VciBaseException 转换出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public ClientBusinessObject map2Cbo(Map map) throws VciBaseException { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | public com.vci.client.bof.ClientBusinessObject map2Cbo(Map map) throws VciBaseException { |
| | | com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); |
| | | WebUtil.copyValueToCboFromMap(cbo, map); |
| | | return cbo; |
| | | } |
| | |
| | | deleteReferAttrInCbo(batchCbos.getDeleteCbos()); |
| | | } |
| | | try { |
| | | platformClientUtil.getBOFactoryService().batchCUDBOLO(new BusinessObjectListHolder(cboArray2Bo(batchCbos.getCreateCboArray())), |
| | | new LinkObjectListHolder(cloArray2Lo(batchCbos.getCreateCloArray())), |
| | | new BusinessObjectListHolder(cboArray2Bo(batchCbos.getUpdateCboArray())), |
| | | new LinkObjectListHolder(cloArray2Lo(batchCbos.getUpdateCloArray())), |
| | | // platformClientUtil.getBOFactoryService().batchCUDBOLO(new BusinessObjectListHolder(cboArray2Bo(batchCbos.getCreateCboArray())), |
| | | // new LinkObjectListHolder(cloArray2Lo(batchCbos.getCreateCloArray())), |
| | | // new BusinessObjectListHolder(cboArray2Bo(batchCbos.getUpdateCboArray())), |
| | | // new LinkObjectListHolder(cloArray2Lo(batchCbos.getUpdateCloArray())), |
| | | // cboArray2Bo(batchCbos.getDeleteCboArray()), cloArray2Lo(batchCbos.getDeleteCloArray())); |
| | | // new BusinessObjectListHolder(cboArray2Bo(batchCbos.getCreateCboArray())) |
| | | ServiceProvider.getBOFService().batchCUDBOLO(cboArray2Bo(batchCbos.getCreateCboArray()), |
| | | cloArray2Lo(batchCbos.getCreateCloArray()), |
| | | cboArray2Bo(batchCbos.getUpdateCboArray()), |
| | | cloArray2Lo(batchCbos.getUpdateCloArray()), |
| | | cboArray2Bo(batchCbos.getDeleteCboArray()), cloArray2Lo(batchCbos.getDeleteCloArray())); |
| | | } catch (VCIError e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | |
| | | * @param cbos 客户端对象 |
| | | * @return 业务对象 |
| | | */ |
| | | private BusinessObject[] cboArray2Bo(ClientBusinessObject[] cbos){ |
| | | private com.vci.corba.omd.data.BusinessObject[] cboArray2Bo(ClientBusinessObject[] cbos){ |
| | | if(cbos == null ||cbos.length == 0){ |
| | | return new BusinessObject[0]; |
| | | return new com.vci.corba.omd.data.BusinessObject[0]; |
| | | } |
| | | BusinessObject[] bos = new BusinessObject[cbos.length]; |
| | | com.vci.corba.omd.data.BusinessObject[] bos = new com.vci.corba.omd.data.BusinessObject[cbos.length]; |
| | | for(int i = 0; i < cbos.length; i++){ |
| | | bos[i] = cbos[i].getBusinessObject(); |
| | | } |
| | |
| | | * @param clos 客户端对象 |
| | | * @return 业务对象 |
| | | */ |
| | | private LinkObject[] cloArray2Lo(ClientLinkObject[] clos){ |
| | | private com.vci.corba.omd.data.LinkObject[] cloArray2Lo(com.vci.client.bof.ClientLinkObject[] clos){ |
| | | if(clos == null ||clos.length == 0){ |
| | | return new LinkObject[0]; |
| | | return new com.vci.corba.omd.data.LinkObject[0]; |
| | | } |
| | | LinkObject[] bos = new LinkObject[clos.length]; |
| | | com.vci.corba.omd.data.LinkObject[] bos = new com.vci.corba.omd.data.LinkObject[clos.length]; |
| | | for(int i = 0; i < clos.length; i++){ |
| | | bos[i] = clos[i].getLinkObject(); |
| | | } |
| | |
| | | private void deleteReferAttrInCbo(Set<ClientBusinessObject> cbos){ |
| | | if(cbos !=null){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | BusinessObject bo = cbo.getBusinessObject(); |
| | | List<AttributeValue> newAttr = new ArrayList<AttributeValue>(); |
| | | com.vci.corba.omd.data.BusinessObject bo = cbo.getBusinessObject(); |
| | | List<com.vci.corba.omd.data.AttributeValue> newAttr = new ArrayList<com.vci.corba.omd.data.AttributeValue>(); |
| | | if (bo.newAttrValList != null) { |
| | | for (int i = 0; i < bo.newAttrValList.length; ++i) { |
| | | AttributeValue av = bo.newAttrValList[i]; |
| | | com.vci.corba.omd.data.AttributeValue av = bo.newAttrValList[i]; |
| | | if (WebUtil.isNormalAttr(av.attrName)) { |
| | | if(av.attrVal == null){ |
| | | av.attrVal = ""; |
| | |
| | | } |
| | | } |
| | | } |
| | | bo.newAttrValList = newAttr.toArray(new AttributeValue[0]); |
| | | bo.newAttrValList = newAttr.toArray(new com.vci.corba.omd.data.AttributeValue[0]); |
| | | cbo.setBusinessObject(bo); |
| | | } |
| | | } |