| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vci.base.common.utility.ObjectUtility; |
| | | import com.vci.client.common.providers.ServiceProvider; |
| | | import com.vci.corba.common.VCIError; |
| | | import com.vci.corba.omd.qtm.QTInfo; |
| | | import com.vci.corba.query.ObjectQueryService; |
| | | import com.vci.corba.query.ObjectQueryServicePrx; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.mw.client.InvocationUtility; |
| | | import com.vci.starter.web.annotation.Column; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.constant.VciSystemVarConstants; |
| | | import com.vci.corba.query.data.BtmRefQueryOption; |
| | | import com.vci.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.tools.ant.taskdefs.condition.Os; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.DocumentHelper; |
| | | import org.omg.CORBA.IntHolder; |
| | |
| | | import plm.bs.bom.clientobject.ClientBusinessObject; |
| | | import plm.bs.bom.clientobject.ClientLinkObject; |
| | | import plm.bs.bom.common.*; |
| | | import plm.corba.qt.BtmRefQueryOption; |
| | | import plm.corba.qt.KV; |
| | | import plm.corba.qt.QTServiceOperations; |
| | | import plm.corba.qt.QTWrapper; |
| | | import plm.oq.objectQuery.common.*; |
| | | |
| | | import java.lang.reflect.Field; |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化业务类型 |
| | |
| | | return checkDataExsitByColumn(btmName,columnName,Arrays.asList(columnValues.split(","))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据查询条件来查询业务类型下的数据 |
| | | * @param btmType 业务类型的名称,会自动变成小写 |
| | |
| | | clauseList.add("*"); |
| | | } |
| | | setRightValueToQueryTemplate(qt,conditionMap);//设置密级查询,和数据权限控制 |
| | | List<BtmRefQueryOption> refOpts = new ArrayList<BtmRefQueryOption>(); |
| | | List<com.vci.corba.query.data.BtmRefQueryOption> refOpts = new ArrayList<BtmRefQueryOption>(); |
| | | List<String> enumAttrName = new ArrayList<String>(); |
| | | List<String> thisQueryAttr = new ArrayList<String>(); |
| | | if(clauseList!=null && clauseList.size()>0){ |
| | |
| | | |
| | | //设置分页信息和排序 |
| | | setPageAndOrderToQT(qt,ph); |
| | | try { |
| | | QTServiceOperations qtService = platformClientUtil.getQueryService(); |
| | | //try { |
| | | //QTServiceOperations qtService = platformClientUtil.getQueryService(); |
| | | ObjectQueryServicePrx qtService = ServiceProvider.getOQService(); |
| | | if(qtService == null){ |
| | | logger.error("没有找到查询服务"); |
| | | throw new VciBaseException(msgCodePrefix+"qtServerNull", new String[]{}); |
| | | } |
| | | IntHolder count = new IntHolder(); |
| | | BusinessObject[] bos = null; |
| | | ObjectQueryService.FindBTMObjectsV3Result bos = null; |
| | | String invo = JSONObject.toJSONString(InvocationUtility.getInvocation()); |
| | | try{ |
| | | bos = qtService.findBTMObjectsV4(invo,qt.getId(), Tool.qtTOXMl(qt).asXML(),count,refOpts.toArray(new BtmRefQueryOption[0])); |
| | | String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
| | | "<Data>\n" + |
| | | " <QueryTemplate id=\"querySubFolder\" type=\"btm\">\n" + |
| | | " <clauseList>querycondition,sequence,folderoid,folderbusinesstype,secretgrade,workcontextoid,checkoutby,revisionrule,hisattrvallist,isfirstv,lastmodifier,description,newattrvallist,oid,revisionid,revisionvalue,isfirstr,id,checkouttime,copyfromversion,owner,creator,checkintime,revisionseq,versionrule,versionvalue,versionseq,checkinby,lcstatus,createtime,lastmodifytime,lctid,name,islastr,nameoid,islastv,btmname,ts</clauseList>\n" + |
| | | " <linkType></linkType>\n" + |
| | | " <btmType>folder</btmType>\n" + |
| | | " <queryChildrenFlag>false</queryChildrenFlag>\n" + |
| | | " <queryISLeaf>false</queryISLeaf>\n" + |
| | | " <rightFlag>false</rightFlag>\n" + |
| | | " <secretFlag>true</secretFlag>\n" + |
| | | " <version>0</version>\n" + |
| | | " <levelRec>-1</levelRec>\n" + |
| | | " <recReturnMode>1</recReturnMode>\n" + |
| | | " <orderInfos>\n" + |
| | | " <orderInfo>\n" + |
| | | " <orderField>sequence</orderField>\n" + |
| | | " <orderMode>ASC</orderMode>\n" + |
| | | " <level>1</level>\n" + |
| | | " </orderInfo>\n" + |
| | | " </orderInfos>\n" + |
| | | " </QueryTemplate>\n" + |
| | | "</Data>"; |
| | | //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 (VCIError e){ |
| | | bos = qtService.findBTMObjectsV4(invo,qt.getId(), Tool.qtTOXMl(qt).asXML(),count,refOpts.toArray(new BtmRefQueryOption[0])); |
| | | //bos = qtService.findBTMObjectsV4(invo,qt.getId(), Tool.qtTOXMl(qt).asXML(),count,refOpts.toArray(new BtmRefQueryOption[0])); |
| | | } |
| | | |
| | | if (bos != null && bos.length > 0) { |
| | | for (BusinessObject bo : bos) { |
| | | if (bos != null && bos.count > 0) { |
| | | for (com.vci.corba.omd.data.BusinessObject bo : bos.returnValue) { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | cbo.setBusinessObject(bo); |
| | | queryEnumText(cbo,enumAttrName); |
| | | //cbo.setBusinessObject(bo); |
| | | //queryEnumText(cbo,enumAttrName); |
| | | allCbos.add(cbo); |
| | | } |
| | | //因为修改了查询的方式,所以就不需要单独查询参照 |
| | | } |
| | | queryLcStatus(allCbos); |
| | | } catch (VCIError e) { |
| | | // logger.error(e.error_code,e); |
| | | // throw WebUtil.getVciBaseException(e); |
| | | } |
| | | //queryLcStatus(allCbos); |
| | | //} //catch (VCIError e) { |
| | | // // logger.error(e.error_code,e); |
| | | // // hrow WebUtil.getVciBaseException(e); |
| | | // } |
| | | return allCbos; |
| | | } |
| | | |
| | |
| | | QueryTemplate qt = null; |
| | | try{ |
| | | VciBaseUtil.alertNotNull(name,"查询模板的名称"); |
| | | QTWrapper wrapper = platformClientUtil.getQueryService().getQT(name); |
| | | // QTWrapper wrapper = platformClientUtil.getQueryService().getQT(name); |
| | | QTInfo wrapper = ServiceProvider.getOMDService().getQTDService().getQT(name); |
| | | qt = Tool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), name); |
| | | //因为之前平台的Tool.replaceQTValues 没有处理 ${xxx}。, 为了忽略大小写,我们这里单独处理 weidy@2021-3-10 |
| | | //我们转换为小写 |
| | | Condition condition = qt.getCondition(); |
| | | Map<String,String> replaceLowMap = new HashMap<>(); |
| | | if(condition !=null && condition.getCIMap()!=null){ |
| | | Map<String, String> systemVarValueMap = VciSystemVarConstants.getSystemVarValueMap(); |
| | | // Map<String, String> systemVarValueMap = VciSystemVarConstants.getSystemVarValueMap(); |
| | | if(!CollectionUtils.isEmpty(replaceMap)){ |
| | | replaceMap.forEach((key,value)->{ |
| | | replaceLowMap.put(key.toLowerCase(),value); |
| | |
| | | if(StringUtils.isNotBlank(value)){ |
| | | if(value.contains("#")){ |
| | | //系统变量.支持一个 |
| | | lInfo.getValue().setOrdinaryValue(systemVarValueMap.getOrDefault(value.toUpperCase(),"")); |
| | | //lInfo.getValue().setOrdinaryValue(systemVarValueMap.getOrDefault(value.toUpperCase(),"")); |
| | | }else if(value.contains("${")){ |
| | | //有${xxxx}的方式 |
| | | if(!CollectionUtils.isEmpty(replaceLowMap)) { |
| | |
| | | }); |
| | | } |
| | | }catch(VCIError e){ |
| | | // logger.error(e.error_code,e); |
| | | // throw WebUtil.getVciBaseException(e); |
| | | //logger.error(e.error_code,e); |
| | | //throw WebUtil.getVciBaseException(e); |
| | | } catch (DocumentException e) { |
| | | logger.error("查询模板转换",e); |
| | | throw new VciBaseException(this.msgCodePrefix + "qtError", new Object[]{name}); |