| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.common.oq.OQTool; |
| | | import com.vci.common.qt.object.*; |
| | | import com.vci.common.utility.ObjectUtility; |
| | |
| | | import com.vci.corba.query.data.BtmRefQueryOption; |
| | | import com.vci.corba.query.data.KV; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.pagemodel.*; |
| | | import com.vci.starter.web.annotation.Column; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.enumpck.BooleanEnum; |
| | |
| | | import com.vci.starter.web.util.BeanUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | 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.PlatformClientUtil; |
| | |
| | | /** |
| | | * 已经创建过的业务对象 |
| | | */ |
| | | private static Map<String, ClientBusinessObject> hasCreatedCbos = new HashMap<String, ClientBusinessObject>(); |
| | | private static Map<String, BusinessObject> hasCreatedCbos = new HashMap<String, BusinessObject>(); |
| | | |
| | | /** |
| | | * 业务对象默认属性 |
| | |
| | | * @throws VciBaseException 初始化出错的是会抛出异常 |
| | | */ |
| | | @Override |
| | | public ClientBusinessObject createCBOByBtmName(String btmName) |
| | | public BusinessObject createCBOByBtmName(String btmName) |
| | | throws VciBaseException { |
| | | if(btmName!=null){ |
| | | btmName = btmName.trim().toLowerCase(); |
| | | } |
| | | //todo 由于登录问题后续需要修改 |
| | | // String userid = WebUtil.getCurrentUserId(); |
| | | String userid = "1"; |
| | | String userid = WebUtil.getCurrentUserId(); |
| | | if(!hasCreatedCbos.containsKey(btmName)){ |
| | | if(StringUtils.isEmpty(userid)){ |
| | | throw new VciBaseException(msgCodePrefix +"noHasUserid"); |
| | | } |
| | | try { |
| | | // ClientServiceProvider.getBOFService().initBusinessObject(btmName); 可以进行替换 |
| | | hasCreatedCbos.put(btmName, createBusinessObject(btmName)); |
| | | } catch (Exception e) { |
| | | logger.error("创建业务类型对象",e); |
| | | throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); |
| | | } |
| | | } |
| | | ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); |
| | | BusinessObject cbo = cloneBusinessObject(hasCreatedCbos.get(btmName)); |
| | | return cbo; |
| | | } |
| | | |
| | |
| | | * @param boName 业务类型名称 |
| | | * @return 业务数据对象 |
| | | */ |
| | | public ClientBusinessObject createBusinessObject(String boName) { |
| | | public BusinessObject createBusinessObject(String boName) throws PLException { |
| | | // ClientServiceProvider.getBOFService().initBusinessObject(boName); |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); |
| | | String userName = WebUtil.getCurrentUserId(); |
| | | ClientBusinessObject bo = new ClientBusinessObject(); |
| | | bo.setOid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setNameoid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setBtmName(boName); |
| | | bo.setIsLastR(true); |
| | | bo.setIsFirstR(true); |
| | | bo.setIsFirstV(true); |
| | | bo.setIsLastV(true); |
| | | bo.setCreator(userName); |
| | | bo.setCreateTime(System.currentTimeMillis()); |
| | | bo.setLastModifier(userName); |
| | | bo.setLastModifyTime(System.currentTimeMillis()); |
| | | bo.setRevisionRule(btmTypeVO.getRevisionRuleId()); |
| | | bo.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); |
| | | BusinessObject bo = new BusinessObject(); |
| | | bo.oid = (new ObjectUtility()).getNewObjectID36(); |
| | | bo.revisionid = (new ObjectUtility()).getNewObjectID36(); |
| | | bo.nameoid = (new ObjectUtility()).getNewObjectID36(); |
| | | bo.btName = boName; |
| | | bo.isLastR = true; |
| | | bo.isFirstR = true; |
| | | bo.isFirstV = true; |
| | | bo.isLastV = true; |
| | | bo.creator = userName; |
| | | bo.createTime = System.currentTimeMillis(); |
| | | bo.modifier = userName; |
| | | bo.modifyTime = System.currentTimeMillis(); |
| | | bo.revisionRule = btmTypeVO.getRevisionRuleId(); |
| | | bo.versionRule = String.valueOf(btmTypeVO.getVersionRule()); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){ |
| | | OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionRuleId()); |
| | | bo.setRevisionValue(revisionRuleVO.getStartCode()); |
| | | bo.revisionValue = revisionRuleVO.getInitialValue(); |
| | | } |
| | | |
| | | bo.setRevisionSeq((short) 1); |
| | | bo.setVersionSeq((short) 1); |
| | | bo.setVersionValue(getVersionValue(WebUtil.getInt(btmTypeVO.getVersionRule()))); |
| | | bo.setLctId(btmTypeVO.getLifeCycleId()); |
| | | bo.revisionSeq = (short) 1; |
| | | bo.versionSeq = (short) 1; |
| | | bo.versionValue = getVersionValue(WebUtil.getInt(btmTypeVO.getVersionRule())); |
| | | bo.lctId = btmTypeVO.getLifeCycleId(); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ |
| | | OsLifeCycleVO lifeCycleVO = lifeService.getLifeCycleById(btmTypeVO.getLifeCycleId()); |
| | | //todo 无法获取数据 |
| | | // bo.setLcStatus(lifeCycleVO.getStartStatus()); |
| | | bo.lcStatus = lifeCycleVO == null ? "" : lifeCycleVO.getStartStatus(); |
| | | } |
| | | bo.setId(""); |
| | | bo.setName(""); |
| | | bo.setDescription(""); |
| | | bo.setOwner(userName); |
| | | bo.id = ""; |
| | | bo.name = ""; |
| | | bo.description = ""; |
| | | bo.owner = userName; |
| | | // bo.setCheckinBy(userName); |
| | | bo.setCopyFromVersion(""); |
| | | bo.fromVersion = ""; |
| | | this.initTypeAttributeValue(bo,btmTypeVO); |
| | | return bo; |
| | | } |
| | |
| | | * @param cbo 业务数据对象 |
| | | * @param btmTypeVO 业务类型的显示对象 |
| | | */ |
| | | private void initTypeAttributeValue(ClientBusinessObject cbo,OsBtmTypeVO btmTypeVO) { |
| | | private void initTypeAttributeValue(BusinessObject cbo,OsBtmTypeVO btmTypeVO) { |
| | | Optional.ofNullable(btmTypeVO.getAttributes()).orElseGet(()->new ArrayList<>()).stream().forEach(attribute->{ |
| | | try { |
| | | cbo.setAttributeValueWithNoCheck(attribute.getId(),attribute.getDefaultValue()); |
| | | } catch (PLException vciError) { |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error("设置属性的值的时候出现了错误",vciError); |
| | | } |
| | | } |
| | | ObjectTool.setBOAttributeValue(cbo,attribute.getId(),attribute.getDefaultValue()); |
| | | }); |
| | | } |
| | | |
| | |
| | | * @param cbo 以前的业务数据对象 |
| | | * @return 拷贝后的对象 |
| | | */ |
| | | private ClientBusinessObject cloneClientBusinessObject(ClientBusinessObject cbo){ |
| | | private BusinessObject cloneBusinessObject(BusinessObject cbo){ |
| | | if(cbo !=null){ |
| | | BusinessObject businessObject = new BusinessObject(); |
| | | BusinessObject bo = cbo.getBusinessObject(); |
| | | businessObject.oid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.revisionid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.nameoid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.btName = bo.btName; |
| | | businessObject.isLastR = bo.isLastR; |
| | | businessObject.isFirstR = bo.isFirstR; |
| | | businessObject.isLastV = bo.isLastV; |
| | | businessObject.isFirstV = bo.isFirstV; |
| | | businessObject.btName = cbo.btName; |
| | | businessObject.isLastR = cbo.isLastR; |
| | | businessObject.isFirstR = cbo.isFirstR; |
| | | businessObject.isLastV = cbo.isLastV; |
| | | businessObject.isFirstV = cbo.isFirstV; |
| | | businessObject.creator = WebUtil.getCurrentUserId(); |
| | | 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.revisionValue = bo.revisionValue; |
| | | businessObject.versionSeq = bo.versionSeq; |
| | | businessObject.versionValue = bo.versionValue; |
| | | businessObject.lctId = bo.lctId; |
| | | businessObject.lcStatus = bo.lcStatus; |
| | | businessObject.modifier = cbo.modifier; |
| | | businessObject.modifyTime = cbo.modifyTime; |
| | | businessObject.revisionRule = cbo.revisionRule; |
| | | businessObject.versionRule = cbo.versionRule; |
| | | businessObject.revisionSeq = cbo.revisionSeq; |
| | | businessObject.revisionValue = cbo.revisionValue; |
| | | businessObject.versionSeq = cbo.versionSeq; |
| | | businessObject.versionValue = cbo.versionValue; |
| | | businessObject.lctId = cbo.lctId; |
| | | businessObject.lcStatus = cbo.lcStatus; |
| | | businessObject.ts = System.currentTimeMillis(); |
| | | businessObject.id = bo.id; |
| | | businessObject.name = bo.name; |
| | | businessObject.description = bo.description; |
| | | businessObject.id = cbo.id; |
| | | businessObject.name = cbo.name; |
| | | businessObject.description = cbo.description; |
| | | businessObject.owner = businessObject.creator; |
| | | // 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); |
| | | businessObject.fromVersion = cbo.fromVersion; |
| | | if(cbo.newAttrValList !=null){ |
| | | businessObject.newAttrValList = clone(cbo.newAttrValList); |
| | | } |
| | | if(bo.hisAttrValList !=null){ |
| | | businessObject.hisAttrValList = clone(bo.hisAttrValList); |
| | | if(cbo.hisAttrValList !=null){ |
| | | businessObject.hisAttrValList = clone(cbo.hisAttrValList); |
| | | } |
| | | ClientBusinessObject cbo2 = new ClientBusinessObject(); |
| | | cbo2.setBusinessObject(businessObject); |
| | | return cbo2; |
| | | return businessObject; |
| | | }else { |
| | | return null; |
| | | } |
| | |
| | | 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<com.vci.client.bof.ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null, Arrays.asList(new String[]{"oid",fieldName})); |
| | | List<BusinessObject> 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){ |
| | | data.put(cbo.getAttributeValue(fieldName),cbo.getOid()); |
| | | for(BusinessObject cbo : cbos){ |
| | | data.put(ObjectTool.getBOAttributeValue(cbo,fieldName),cbo.oid); |
| | | } |
| | | } |
| | | return data; |
| | |
| | | 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<BusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); |
| | | if(cbos !=null && cbos.size() >0){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | String oid = cbo.getAttributeValue(columnName); |
| | | for(BusinessObject cbo : cbos){ |
| | | String oid = ObjectTool.getBOAttributeValue(cbo,columnName); |
| | | if(oidSet.contains(oid)){ |
| | | oidSet.remove(oid); |
| | | } |
| | |
| | | * @throws VciBaseException 查询出错的是抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBO(String btmType, |
| | | public List<BusinessObject> 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<BusinessObject> 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<BusinessObject> 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<BusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ |
| | | List<BusinessObject> allCbos = new ArrayList<BusinessObject>(); |
| | | if(clauseList == null){ |
| | | clauseList = new ArrayList<String>(); |
| | | clauseList.add("*"); |
| | |
| | | ObjectQueryService.FindBTMObjectsV3Result bos = qtService.findBTMObjectsV3(qt.getId(), OQTool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[refOpts.size()])); |
| | | if (bos != null && bos.count > 0) { |
| | | for (BusinessObject bo : bos.returnValue) { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | cbo.setBusinessObject(bo); |
| | | queryEnumText(cbo,enumAttrName); |
| | | allCbos.add(cbo); |
| | | // BusinessObject cbo = new BusinessObject(); |
| | | // cbo = bo; |
| | | queryEnumText(bo,enumAttrName); |
| | | allCbos.add(bo); |
| | | } |
| | | //因为修改了查询的方式,所以就不需要单独查询参照 |
| | | } |
| | |
| | | * 查询生命周期的值 |
| | | * @param cbos 业务对象 |
| | | */ |
| | | private void queryLcStatus(List<ClientBusinessObject> cbos){ |
| | | private void queryLcStatus(List<BusinessObject> cbos){ |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | |
| | | Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap(); |
| | | cbos.stream().forEach(cbo->{ |
| | | try{ |
| | | cbo.setAttributeValueWithNoCheck("lcStatus_text", statusVOMap.getOrDefault(cbo.getLcStatus(),new OsStatusVO()).getName()); |
| | | ObjectTool.setBOAttributeValue(cbo,"lcStatus_text", statusVOMap.getOrDefault(cbo.lcStatus,new OsStatusVO()).getName()); |
| | | }catch(Exception e){ |
| | | logger.error("获取生命周期中状态的显示文本出错",e); |
| | | } |
| | |
| | | * @param enumAttrName 枚举属性的值 |
| | | * @throws VciBaseException |
| | | */ |
| | | private void queryEnumText(ClientBusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ |
| | | private void queryEnumText(BusinessObject 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(BusinessObject cbo, LinkObject clo, List<String> enumAttrName) throws VciBaseException{ |
| | | if(enumAttrName.size()>0){//查询枚举 |
| | | for(String enumAttr:enumAttrName){//格式为 code_field code是枚举的编码,field是当前业务类型存储枚举值的字段 |
| | | if(enumAttr.toLowerCase().equals("creator_name")){ |
| | | //创建人的名称 |
| | | String creator = ""; |
| | | if(cbo!=null){ |
| | | creator = cbo.getCreator(); |
| | | creator = cbo.creator; |
| | | }else{ |
| | | creator = clo.getCreator(); |
| | | creator = clo.creator; |
| | | } |
| | | if(StringUtils.isNotBlank(creator)){ |
| | | String userTrueName = userQueryService.getUserNameByUserId(creator); |
| | |
| | | //最后修改人名称 |
| | | String modifier = ""; |
| | | if(cbo!=null){ |
| | | modifier = cbo.getLastModifier(); |
| | | modifier = cbo.modifier; |
| | | }else{ |
| | | modifier = clo.getLastModifier(); |
| | | modifier = clo.modifier; |
| | | } |
| | | if(StringUtils.isNotBlank(modifier)){ |
| | | String userTrueName = userQueryService.getUserNameByUserId(modifier); |
| | |
| | | if(fields.contains("_")){ |
| | | String valueField = ""; |
| | | valueField = fields.split("_")[0]; |
| | | String value = cbo.getAttributeValue(valueField); |
| | | String value = ObjectTool.getBOAttributeValue(cbo,valueField);; |
| | | if(StringUtils.isNotBlank(value)){ |
| | | String userTrueName = userQueryService.getUserNameByUserId(value); |
| | | setValueToCboOrClo(cbo,clo,enumAttr,userTrueName); |
| | |
| | | } |
| | | String enumKey = ""; |
| | | if (cbo != null) { |
| | | enumKey = cbo.getAttributeValue(valueFieldName); |
| | | enumKey = ObjectTool.getBOAttributeValue(cbo,valueFieldName); |
| | | } else if (clo != null) { |
| | | enumKey = clo.getAttributeValue(valueFieldName); |
| | | enumKey = ObjectTool.getLOAttributeValue(clo,valueFieldName); |
| | | } |
| | | String enumText = ""; |
| | | if (WebUtil.isNotNull(enumKey)) { |
| | |
| | | * @param attr 属性名 |
| | | * @param value 值 |
| | | */ |
| | | private void setValueToCboOrClo(ClientBusinessObject cbo,ClientLinkObject clo,String attr,String value){ |
| | | private void setValueToCboOrClo(BusinessObject cbo,LinkObject clo,String attr,String value){ |
| | | try { |
| | | if (cbo != null) { |
| | | cbo.setAttributeValueWithNoCheck(attr, value); |
| | | ObjectTool.setBOAttributeValue(cbo, attr, value); |
| | | }else{ |
| | | setAttributeValueForClo(clo,attr, value); |
| | | } |
| | |
| | | * @param attributeValue 属性的值 |
| | | */ |
| | | @Override |
| | | public void setAttributeValueForClo(ClientLinkObject clo, String attributeName, String attributeValue) { |
| | | AttributeValue[] attrValues = clo.getLinkObject().newAttrValList; |
| | | public void setAttributeValueForClo(LinkObject clo, String attributeName, String attributeValue) { |
| | | AttributeValue[] attrValues = clo.newAttrValList; |
| | | ArrayList<AttributeValue> attrValList = new ArrayList(); |
| | | AttributeValue attrVal; |
| | | int i; |
| | |
| | | attrValList.add(attrVal); |
| | | } |
| | | |
| | | clo.getLinkObject().newAttrValList = (AttributeValue[]) attrValList.toArray(new AttributeValue[attrValList.size()]); |
| | | clo.newAttrValList = attrValList.toArray(new AttributeValue[attrValList.size()]); |
| | | } |
| | | |
| | | |
| | |
| | | * @param enumAttrName 枚举属性 |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | private void queryEnumTextClo(ClientLinkObject clo,List<String> enumAttrName) throws VciBaseException{ |
| | | private void queryEnumTextClo(LinkObject clo,List<String> enumAttrName) throws VciBaseException{ |
| | | queryEnumText(null,clo,enumAttrName); |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | public List<BusinessObject> 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<BusinessObject> 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<BusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | PageHelper ph, List<String> clauseList) throws VciBaseException { |
| | | QueryTemplate qt = getQtByName(queryScheme,replaceMap); |
| | |
| | | * @throws VciBaseException 查询出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryBySql(String sql, |
| | | public List<BusinessObject> 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<BusinessObject>(); |
| | | }else{ |
| | | return map2Cbos(allData); |
| | | } |
| | |
| | | * @throws VciBaseException 查询出错活抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException{ |
| | | public List<BusinessObject> queryByOnlySql(String sql) throws VciBaseException{ |
| | | List<Map> allData = queryByOnlySqlForMap(sql); |
| | | if(allData == null || allData.size() == 0){ |
| | | return new ArrayList<ClientBusinessObject>(); |
| | | return new ArrayList<BusinessObject>(); |
| | | }else{ |
| | | return map2Cbos(allData); |
| | | } |
| | |
| | | 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<BusinessObject> 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(BusinessObject cbo : allCbos){ |
| | | T obj = null; |
| | | try { |
| | | obj = c.newInstance(); |
| | |
| | | } catch (IllegalAccessException e) { |
| | | } |
| | | if(obj !=null){ |
| | | oids.add(cbo.getOid()); |
| | | oids.add(cbo.oid); |
| | | allObject.add(obj); |
| | | } |
| | | } |
| | |
| | | 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<BusinessObject> 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(BusinessObject cbo : allCbos){ |
| | | T obj = null; |
| | | try { |
| | | obj = c.newInstance(); |
| | |
| | | } catch (IllegalAccessException e) { |
| | | } |
| | | if(obj !=null){ |
| | | oids.add(cbo.getOid()); |
| | | oids.add(cbo.oid); |
| | | allObject.add(obj); |
| | | } |
| | | } |
| | |
| | | * @param isEdit 是否为编辑 |
| | | * @throws VciBaseException 设置出错会抛出异常 |
| | | */ |
| | | private void setValueToCbo(Object obj,String btmType,ClientBusinessObject cbo ,boolean isEdit) throws VciBaseException{ |
| | | private void setValueToCbo(Object obj,String btmType,BusinessObject cbo ,boolean isEdit) throws VciBaseException{ |
| | | Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); |
| | | if(pkField == null){ |
| | | throw new VciBaseException("{0}类中没有定义主键属性",new Object[]{obj.getClass()}); |
| | |
| | | //主键 |
| | | Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); |
| | | if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ |
| | | WebUtil.setValueToField(pkField.getName(), obj, cbo.getOid()); |
| | | pkValue = cbo.getOid(); |
| | | WebUtil.setValueToField(pkField.getName(), obj, cbo.oid); |
| | | pkValue = cbo.oid; |
| | | }else{ |
| | | cbo.setOid(pkValue.toString()); |
| | | cbo.oid = pkValue.toString(); |
| | | } |
| | | //进行非空,长度,重复的校验。。校验通过的赋值 |
| | | Map<String,String> fieldMap = WebUtil.getFieldNameMap(obj.getClass()); |
| | |
| | | //说明不能重复,那么就需要查询一下 |
| | | Map<String,String> queryRepeatMap = getOneQuery(attrName, value); |
| | | if(isEdit){ |
| | | queryRepeatMap.put("oid", QueryOptionConstant.NOTEQUAL + cbo.getOid()); |
| | | queryRepeatMap.put("oid", QueryOptionConstant.NOTEQUAL + cbo.oid); |
| | | } |
| | | if(queryCount(btmType, queryRepeatMap)>0){ |
| | | throw new VciBaseException("{0}字段的值{1}在系统中已经存在", new Object[]{columnText,value}); |
| | |
| | | if(isEdit && checkUnAttrUnEdit(attrName)){ |
| | | //编辑的时候,TS和OID不能设置.因为平台那接口设置了就会报错 |
| | | }else { |
| | | try { |
| | | //需要判断是否默认的属性,如果是默认属性,则使用对象的赋值的方式 |
| | | if (WebUtil.isDefaultField(fieldName) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) { |
| | | WebUtil.setValueToField(fieldName, cbo, value); |
| | | cbo.setAttributeValueWithNoCheck(attrName.toLowerCase(), value); |
| | | } else { |
| | | cbo.setAttributeValueWithNoCheck(attrName.toLowerCase(), value); |
| | | } |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | //需要判断是否默认的属性,如果是默认属性,则使用对象的赋值的方式 |
| | | if (WebUtil.isDefaultField(fieldName) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) { |
| | | WebUtil.setValueToField(fieldName, cbo, value); |
| | | ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value); |
| | | } else { |
| | | ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value); |
| | | } |
| | | } |
| | | } |
| | |
| | | if(list==null){ |
| | | throw new VciBaseException(VciBaseException.paramNull); |
| | | } |
| | | Set<ClientBusinessObject> allCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<BusinessObject> allCbos = new HashSet<BusinessObject>(); |
| | | for(T obj : list){ |
| | | //需要处理默认值 |
| | | Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); |
| | |
| | | throw new VciBaseException("{0}对象中没有设置主键的属性",new Object[]{obj.getClass()}); |
| | | } |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | | ClientBusinessObject cbo = createCBOByBtmName(btmType); |
| | | BusinessObject cbo = createCBOByBtmName(btmType); |
| | | setValueToCbo(obj,btmType,cbo,false); |
| | | allCbos.add(cbo); |
| | | } |
| | |
| | | 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<BusinessObject> allUpdateCbos = new HashSet<BusinessObject>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | Set<BusinessObject> allAddCbos = new HashSet<BusinessObject>(); |
| | | 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<BusinessObject> needUpdateCbos = new ArrayList<BusinessObject>(); |
| | | Iterator<String> it = btmOidsMap.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | | String btmType = it.next(); |
| | |
| | | } |
| | | //主键 |
| | | Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); |
| | | ClientBusinessObject cbo = null; |
| | | BusinessObject cbo = null; |
| | | if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ |
| | | continue; |
| | | }else{ |
| | | for(ClientBusinessObject tempCbo : needUpdateCbos){ |
| | | if(tempCbo.getOid().equalsIgnoreCase(pkValue.toString().trim())){ |
| | | for(BusinessObject tempCbo : needUpdateCbos){ |
| | | if(tempCbo.oid.equalsIgnoreCase(pkValue.toString().trim())){ |
| | | cbo = tempCbo; |
| | | break; |
| | | } |
| | |
| | | } |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | | //拷贝之前先清除已经有的值 |
| | | cbo.getBusinessObject().newAttrValList = new AttributeValue[0]; |
| | | cbo.newAttrValList = new AttributeValue[0]; |
| | | setValueToCbo(obj,btmType,cbo,true); |
| | | allUpdateCbos.add(cbo); |
| | | } |
| | |
| | | if(list==null){ |
| | | throw new VciBaseException(VciBaseException.paramNull); |
| | | } |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); |
| | | for(Object obj : list){ |
| | | //有可能不属于同一个业务类型下 |
| | | Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); |
| | |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | | String pkValue = WebUtil.getValueFromFieldForCbo(pkField, obj); |
| | | //所以这里也是直接查询的单个' |
| | | List<ClientBusinessObject> deleteCbos = queryCBO(btmType, getOneQuery( |
| | | List<BusinessObject> deleteCbos = queryCBO(btmType, getOneQuery( |
| | | WebUtil.getCboAttrNameFromField(pkField, obj.getClass()), pkValue)); |
| | | if(deleteCbos!=null){ |
| | | allDeleteCbos.addAll(deleteCbos); |
| | |
| | | * @param btmBos 业务数据 |
| | | * @throws VciBaseException 被引用的时候会抛出异常 |
| | | */ |
| | | private void checkCanDelete(Map<String,List<ClientBusinessObject>> btmBos) throws VciBaseException{ |
| | | private void checkCanDelete(Map<String,List<BusinessObject>> btmBos) throws VciBaseException{ |
| | | //查找表是否被其他的属性引用 |
| | | if(!btmBos.isEmpty()){ |
| | | Iterator<String> it = btmBos.keySet().iterator(); |
| | |
| | | List<OsUsedAttributeVO> usedAttrVOs = btmService.listBtmUsedInfo(btmType); |
| | | |
| | | Map<String, List<OsUsedAttributeVO>> allReferAttr = Optional.ofNullable(usedAttrVOs).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.groupingBy(s -> s.getPkBtmType())); |
| | | List<ClientBusinessObject> thisBtmTypeBo = btmBos.get(btmType); |
| | | List<BusinessObject> thisBtmTypeBo = btmBos.get(btmType); |
| | | if(thisBtmTypeBo.size()== 0){ |
| | | return; |
| | | } |
| | | String oids = ""; |
| | | for(ClientBusinessObject cbo : thisBtmTypeBo){ |
| | | oids += "'" + cbo.getOid() + "',"; |
| | | for(BusinessObject cbo : thisBtmTypeBo){ |
| | | oids += "'" + cbo.oid + "',"; |
| | | } |
| | | oids = WebUtil.removeComma(oids); |
| | | if(!allReferAttr.isEmpty()){ |
| | |
| | | conditionMap = new HashMap<String, String>(); |
| | | } |
| | | conditionMap.put(QUERY_FILTER_SECRET,BooleanEnum.FASLE.getValue());//查询的时候不能查询密级 |
| | | List<ClientBusinessObject> allCbos = queryCBO(btmType, conditionMap); |
| | | List<BusinessObject> allCbos = queryCBO(btmType, conditionMap); |
| | | BatchCBO batchCbo = new BatchCBO(); |
| | | if(allCbos.size()>0){ |
| | | Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); |
| | | Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); |
| | | btmBos.put(btmType, allCbos); |
| | | checkCanDelete(btmBos); |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | allDeleteCbos.addAll(allCbos); |
| | | batchCbo.setDeleteCbos(allDeleteCbos); |
| | | } |
| | |
| | | selectSql += ",btmname "; |
| | | } |
| | | sql = selectSql + fromSql; |
| | | List<ClientBusinessObject> allDelete =queryBySql(sql, conditionMap); |
| | | List<BusinessObject> allDelete =queryBySql(sql, conditionMap); |
| | | if(allDelete.size() == 0){ |
| | | return batchCbo;//没有删除任何数据 |
| | | } |
| | | //找btmType; |
| | | String btmType = allDelete.get(0).getAttributeValue("btmName"); |
| | | Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); |
| | | String btmType = ObjectTool.getBOAttributeValue(allDelete.get(0),"btmName"); |
| | | Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); |
| | | btmBos.put(btmType, allDelete); |
| | | checkCanDelete(btmBos); |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | //我们需要从后台查询整个的内容才可以执行删除, |
| | | String oids = ""; |
| | | for(ClientBusinessObject cbo : allDelete){ |
| | | oids += "'" + cbo.getOid() + "',"; |
| | | for(BusinessObject cbo : allDelete){ |
| | | oids += "'" + cbo.oid + "',"; |
| | | } |
| | | conditionMap.clear(); |
| | | conditionMap.put("oid", QueryOptionConstant.IN + "(" + WebUtil.removeComma(oids) + ")"); |
| | | List<ClientBusinessObject> inDbCbos = queryCBO(btmType, conditionMap); |
| | | List<BusinessObject> inDbCbos = queryCBO(btmType, conditionMap); |
| | | |
| | | allDeleteCbos.addAll(inDbCbos); |
| | | batchCbo.setDeleteCbos(allDeleteCbos); |
| | |
| | | Map<String,String> conditionMap = getOneQuery("oid", pkValue); |
| | | List<String> causeList = new ArrayList<>(); |
| | | causeList.add("ts"); |
| | | List<ClientBusinessObject> cbos = queryCBO(WebUtil.getBtmTypeByObject(obj.getClass()), conditionMap,new PageHelper(-1),causeList); |
| | | List<BusinessObject> cbos = queryCBO(WebUtil.getBtmTypeByObject(obj.getClass()), conditionMap,new PageHelper(-1),causeList); |
| | | if(CollectionUtils.isEmpty(cbos)){ |
| | | return false; |
| | | } |
| | | if(ts.contains(".")){ |
| | | ts = ts.substring(0,ts.lastIndexOf(".")); |
| | | } |
| | | return cbos.get(0).getTs() == Long.valueOf(ts); |
| | | return cbos.get(0).ts == Long.valueOf(ts); |
| | | } |
| | | |
| | | /** |
| | |
| | | ph = new PageHelper(-1); |
| | | ph.setQueryTotal(true); |
| | | } |
| | | List<ClientBusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList); |
| | | List<BusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList); |
| | | DataGrid dg = new DataGrid(); |
| | | if(allCbos.size()>0){ |
| | | List<Map> mapList = cbos2Map(allCbos); |
| | |
| | | if(ph == null){ |
| | | ph = new PageHelper(-1,true); |
| | | } |
| | | List<ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap,replaceMap, ph, clauseList); |
| | | List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap,replaceMap, ph, clauseList); |
| | | DataGrid dg = new DataGrid(); |
| | | if(allCbos.size()>0){ |
| | | List<Map> mapList = cbos2Map(allCbos); |
| | |
| | | } |
| | | |
| | | /** |
| | | * ClientBusinessObject 转为HashMap |
| | | * BusinessObject 转为HashMap |
| | | * @param cbos CBOS |
| | | * @return map |
| | | * @throws VciBaseException 转换出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<Map> cbos2Map(List<ClientBusinessObject> cbos) |
| | | public List<Map> cbos2Map(List<BusinessObject> cbos) |
| | | throws VciBaseException { |
| | | List<Map> mapList = new ArrayList<Map>(); |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | for(BusinessObject cbo : cbos){ |
| | | mapList.add(cbo2Map(cbo)); |
| | | } |
| | | return mapList; |
| | | } |
| | | |
| | | /** |
| | | * ClientBusinessObject 转为HashMap |
| | | * BusinessObject 转为HashMap |
| | | * @param cbo 业务数据对象 |
| | | * @return map |
| | | * @throws VciBaseException 转换出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public Map cbo2Map(ClientBusinessObject cbo) throws VciBaseException { |
| | | public Map cbo2Map(BusinessObject cbo) throws VciBaseException { |
| | | Map<String,String> map = new HashMap<String, String>(); |
| | | WebUtil.copyValueToMapFromCbos(cbo, map); |
| | | return map; |
| | |
| | | |
| | | |
| | | /** |
| | | * map转为clientBusinessObject |
| | | * map转为BusinessObject |
| | | * @param mapList map列表 |
| | | * @return 业务数据列表 |
| | | * @throws VciBaseException 转换出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> map2Cbos(List<Map> mapList) |
| | | public List<BusinessObject> map2Cbos(List<Map> mapList) |
| | | throws VciBaseException { |
| | | List<ClientBusinessObject> cboList = new ArrayList<ClientBusinessObject>(); |
| | | List<BusinessObject> cboList = new ArrayList<BusinessObject>(); |
| | | for(Map map : mapList){ |
| | | cboList.add(map2Cbo(map)); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * map转为clientBusinessObject |
| | | * map转为BusinessObject |
| | | * @param map map |
| | | * @return 业务数据 |
| | | * @throws VciBaseException 转换出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public ClientBusinessObject map2Cbo(Map map) throws VciBaseException { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | public BusinessObject map2Cbo(Map map) throws VciBaseException { |
| | | BusinessObject cbo = new BusinessObject(); |
| | | WebUtil.copyValueToCboFromMap(cbo, map); |
| | | return cbo; |
| | | } |
| | |
| | | * @param cbos 客户端对象 |
| | | * @return 业务对象 |
| | | */ |
| | | private BusinessObject[] cboArray2Bo(ClientBusinessObject[] cbos){ |
| | | private BusinessObject[] cboArray2Bo(BusinessObject[] cbos){ |
| | | if(cbos == null ||cbos.length == 0){ |
| | | return new BusinessObject[0]; |
| | | } |
| | | BusinessObject[] bos = new BusinessObject[cbos.length]; |
| | | for(int i = 0; i < cbos.length; i++){ |
| | | bos[i] = cbos[i].getBusinessObject(); |
| | | bos[i] = cbos[i]; |
| | | } |
| | | return bos; |
| | | } |
| | |
| | | * @param clos 客户端对象 |
| | | * @return 业务对象 |
| | | */ |
| | | private LinkObject[] cloArray2Lo(ClientLinkObject[] clos){ |
| | | private LinkObject[] cloArray2Lo(LinkObject[] clos){ |
| | | if(clos == null ||clos.length == 0){ |
| | | return new LinkObject[0]; |
| | | } |
| | | LinkObject[] bos = new LinkObject[clos.length]; |
| | | for(int i = 0; i < clos.length; i++){ |
| | | bos[i] = clos[i].getLinkObject(); |
| | | bos[i] = clos[i]; |
| | | } |
| | | return bos; |
| | | } |
| | |
| | | * 删除枚举和参照的属性 |
| | | * @param cbos 业务数据 |
| | | */ |
| | | private void deleteReferAttrInCbo(Set<ClientBusinessObject> cbos){ |
| | | private void deleteReferAttrInCbo(Set<BusinessObject> cbos){ |
| | | if(cbos !=null){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | BusinessObject bo = cbo.getBusinessObject(); |
| | | for(BusinessObject cbo : cbos){ |
| | | BusinessObject bo = cbo; |
| | | List<AttributeValue> newAttr = new ArrayList<AttributeValue>(); |
| | | if (bo.newAttrValList != null) { |
| | | for (int i = 0; i < bo.newAttrValList.length; ++i) { |
| | |
| | | } |
| | | } |
| | | bo.newAttrValList = newAttr.toArray(new AttributeValue[0]); |
| | | cbo.setBusinessObject(bo); |
| | | cbo = bo; |
| | | } |
| | | } |
| | | } |
| | |
| | | * @throws VciBaseException 参数为空,数据不存在会抛出异常 |
| | | */ |
| | | @Override |
| | | public ClientBusinessObject selectCBOByOid(String oid, String btmName) throws VciBaseException { |
| | | public BusinessObject selectCBOByOid(String oid, String btmName) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(oid,"主键",btmName,"业务类型"); |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("oid", oid.trim()); |
| | | List<ClientBusinessObject> cbos = queryCBO(btmName, conditionMap); |
| | | List<BusinessObject> cbos = queryCBO(btmName, conditionMap); |
| | | if(CollectionUtils.isEmpty(cbos)){ |
| | | throw new VciBaseException("数据在系统中不存在{0}",new String[]{oid}); |
| | | } |
| | |
| | | * @throws VciBaseException 参数为空,查询出错会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> selectCBOByOidCollection(Collection<String> oidCollection, String btmName) throws VciBaseException { |
| | | public List<BusinessObject> selectCBOByOidCollection(Collection<String> oidCollection, String btmName) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(oidCollection,"主键集合",btmName,"业务类型"); |
| | | Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(oidCollection); |
| | | List<ClientBusinessObject> doList = new ArrayList<ClientBusinessObject>(); |
| | | List<BusinessObject> doList = new ArrayList<BusinessObject>(); |
| | | |
| | | for(Collection<String> oids: oidCollections){ |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | List<ClientBusinessObject> list = queryCBO(btmName, conditionMap); |
| | | List<BusinessObject> list = queryCBO(btmName, conditionMap); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | throw new VciBaseException("{0}条数据在系统中不存在",new String[]{String.valueOf(oids.size())}); |
| | | } |