| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.common.oq.OQTool; |
| | | import com.vci.client.common.providers.ServiceProvider; |
| | | import com.vci.common.qt.object.*; |
| | | import com.vci.common.utility.ObjectUtility; |
| | |
| | | if(key.indexOf("_start")>-1){ |
| | | String attr = key.replace("_start", ""); |
| | | thisConditionMap.put(attr, value); |
| | | condition = Tool.getCondition(thisConditionMap); |
| | | condition = OQTool.getCondition(thisConditionMap); |
| | | if(conditionMap.containsKey(attr + "_end")){//如果没有结束,其实也是允许的; |
| | | Map<String,String> endConditonMap = new HashMap<String, String>(); |
| | | endConditonMap.put(attr, conditionMap.get(attr + "_end")); |
| | | condition = Tool.mergeCondition(condition, Tool.getCondition(endConditonMap), Connector.AND); |
| | | condition = OQTool.mergeCondition(condition, OQTool.getCondition(endConditonMap), Connector.AND); |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | }else { |
| | | thisConditionMap.put(key, value); |
| | | } |
| | | condition = Tool.getCondition(thisConditionMap); |
| | | condition = OQTool.getCondition(thisConditionMap); |
| | | } |
| | | if(mergeCondition == null){ |
| | | mergeCondition = condition; |
| | | }else{ |
| | | mergeCondition = Tool.mergeCondition(mergeCondition, condition, isOr? Connector.OR:Connector.AND); |
| | | mergeCondition = OQTool.mergeCondition(mergeCondition, condition, isOr? Connector.OR:Connector.AND); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @return 查询出来的值 |
| | | * @throws VciBaseException 查询出错的时候会抛出异常 |
| | | */ |
| | | private List<com.vci.client.bof.ClientBusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ |
| | | private List<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("*"); |
| | | } |
| | | setRightValueToQueryTemplate(qt,conditionMap);//设置密级查询,和数据权限控制 |
| | | List<com.vci.corba.query.data.BtmRefQueryOption> refOpts = new ArrayList<BtmRefQueryOption>(); |
| | | List<BtmRefQueryOption> refOpts = new ArrayList<BtmRefQueryOption>(); |
| | | List<String> enumAttrName = new ArrayList<String>(); |
| | | List<String> thisQueryAttr = new ArrayList<String>(); |
| | | if(clauseList!=null && clauseList.size()>0){ |
| | |
| | | conditionMap = WebUtil.getNotNullMap(conditionMap); |
| | | Condition condition = getConditionByMap(conditionMap); |
| | | if(qt.getCondition() !=null) { |
| | | qt.setCondition(Tool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | qt.setCondition(OQTool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | }else { |
| | | qt.setCondition(condition); |
| | | } |
| | |
| | | //设置分页信息和排序 |
| | | setPageAndOrderToQT(qt,ph); |
| | | try { |
| | | // QTServiceOperations qtService = platformClientUtil.getQueryService(); |
| | | ObjectQueryServicePrx qtService = ServiceProvider.getOQService(); |
| | | ObjectQueryServicePrx qtService = platformClientUtil.getQueryService(); |
| | | if(qtService == null){ |
| | | logger.error("没有找到查询服务"); |
| | | throw new VciBaseException(msgCodePrefix+"qtServerNull", new String[]{}); |
| | | } |
| | | // IntHolder count = new IntHolder(); |
| | | ObjectQueryService.FindBTMObjectsV3Result bos = null; |
| | | // String invo = JSONObject.toJSONString(InvocationUtility.getInvocation()); |
| | | try{ |
| | | //bos = qtService.findBTMObjectsV3(invo,qt.getId(), Tool.qtTOXMl(qt).asXML(),count,refOpts.toArray(new BtmRefQueryOption[0])); |
| | | bos = qtService.findBTMObjectsV3(qt.getId(), Tool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[0])); |
| | | }catch (PLException e){ |
| | | //bos = qtService.findBTMObjectsV4(invo,qt.getId(), Tool.qtTOXMl(qt).asXML(),count,refOpts.toArray(new BtmRefQueryOption[0])); |
| | | bos = qtService.findBTMObjectsV3(qt.getId(), Tool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[0])); |
| | | } |
| | | ObjectQueryService.FindBTMObjectsV3Result bos = qtService.findBTMObjectsV3(qt.getId(), OQTool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[refOpts.size()])); |
| | | if (bos != null && bos.count > 0) { |
| | | for (com.vci.corba.omd.data.BusinessObject bo : bos.returnValue) { |
| | | com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); |
| | | for (BusinessObject bo : bos.returnValue) { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | cbo.setBusinessObject(bo); |
| | | queryEnumText(cbo,enumAttrName); |
| | | allCbos.add(cbo); |
| | |
| | | VciBaseUtil.alertNotNull(name,"查询模板的名称"); |
| | | // QTWrapper wrapper = platformClientUtil.getQueryService().getQT(name); |
| | | QTInfo wrapper = ServiceProvider.getOMDService().getQTDService().getQT(name); |
| | | qt = Tool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), name); |
| | | qt = OQTool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), name); |
| | | //因为之前平台的Tool.replaceQTValues 没有处理 ${xxx}。, 为了忽略大小写,我们这里单独处理 weidy@2021-3-10 |
| | | //我们转换为小写 |
| | | Condition condition = qt.getCondition(); |
| | |
| | | }); |
| | | } |
| | | }catch(PLException e){ |
| | | //logger.error(e.error_code,e); |
| | | //throw WebUtil.getVciBaseException(e); |
| | | } catch (DocumentException | VCIError e) { |
| | | logger.error(e.code,e); |
| | | throw WebUtil.getVciBaseException(e); |
| | | } catch (DocumentException e) { |
| | | logger.error("查询模板转换",e); |
| | | throw new VciBaseException(this.msgCodePrefix + "qtError", new Object[]{name}); |
| | | } |
| | |
| | | conditionMap = WebUtil.getNotNullMap(conditionMap); |
| | | Condition condition = getConditionByMap(conditionMap); |
| | | if(qt.getCondition() !=null) { |
| | | qt.setCondition(Tool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | qt.setCondition(OQTool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | }else { |
| | | qt.setCondition(condition); |
| | | } |
| | | int count = 0; |
| | | long count = 0; |
| | | try{ |
| | | // count = platformClientUtil.getQueryService().findTotalCount(); |
| | | count = Integer.parseInt(String.valueOf(ServiceProvider.getOQService().findTotalCount(qt.getId(), Tool.qtTOXMl(qt).asXML()))); |
| | | count = platformClientUtil.getQueryService().findTotalCount(qt.getId(), OQTool.qtTOXMl(qt).asXML()); |
| | | }catch (PLException e) { |
| | | try { |
| | | // 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 (PLException ee) { |
| | | // logger.error(ee.error_code,ee); |
| | | // throw WebUtil.getVciBaseException(ee); |
| | | } |
| | | logger.error(e.code,e); |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | return count; |
| | | return (int) count; |
| | | } |
| | | |
| | | /** |
| | |
| | | if(results!=null && results.length>0 && results[0] != null && results[0].length>0){ |
| | | return WebUtil.getInt(results[0][0]); |
| | | } |
| | | }catch (VCIError e){ |
| | | throw WebUtil.getVciBaseException(e); |
| | | } catch (PLException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return 0; |
| | | } |