EAS_提供多个单据详情查询接口数据给第三方进行单据查看

        EAS版本为8.2.本次由于停用流程助手,需要将在流程助手审批单据,提供给第三方进行审批,因此需要提供审批页面,单据的查看数据进行展示,本次需要提供的查询单据数量较多,为避免频繁编写查询语句,我们可以基于I9摘要去查询,实现最小繁琐复杂的单个单据查询

1、审批任务记录上是有实体全路径的fbillentity,即使只知道单据的iD,我们也能根据ID得到这个单据的类型和实体路径

image

 2、I9摘要记录了单据显示在移动端的字段,我们可以通过实体路径,按如下sql查询即可获取该类单据的在流程助手显示的字段及属性和顺序,其中fmetadatapk 未单据的实体全路径,需要查什么单据类型直接传入

对应的实体全路径即可

SELECT fpropertygroup AS PROPERTY_GROUP,findex,fpropertyname AS PROPERTY_NAME,falias_l2 AS FILED_NAME,fshowformate AS showFormate  
                from T_WM_BillDigest  WHERE fmetadatapk ='com.kingdee.eas.cp.bc.app.BizAccountBill' AND fpropertyname IS NOT NULL ORDER BY fpropertygroup,findex 

 

image

 3,然后将查询的分组名称PROPERTY_GROUP和属性名称property_name拼接到查询对象中,查询即可,这样就不用重新去编写每个单据查询语句,也不会造成所要获取的某个F7字段的名称属性为空

关键代码如下:

public static List<BillDigestVo>  queryBillDetails(Context ctx, String billEntity) throws Exception {
        String prepSql_query = "SELECT fpropertygroup AS PROPERTY_GROUP,fpropertyname AS PROPERTY_NAME,falias_l2 AS FILED_NAME,fshowformate AS showFormate  " +
                "from T_WM_BillDigest  WHERE fmetadatapk ='"+billEntity+"' AND fpropertyname IS NOT NULL ORDER BY fpropertygroup,findex ";
        IRowSet rowSet = DbUtil.executeQuery(ctx, prepSql_query);
        List<BillDigestVo> result = new ArrayList<BillDigestVo>();

        //获取所有的lable
        List<String> columnLabels = new ArrayList<String>();
        if (rowSet != null && rowSet.getMetaData() != null) {
            for (int i = 1; i <= rowSet.getMetaData().getColumnCount(); i++) {
                columnLabels.add(rowSet.getMetaData().getColumnLabel(i));
            }
        }
        // 根据lable获取所有查询结果
        JSONArray columnBodys = new JSONArray();
        while (rowSet.next()) {
            JSONObject row = new JSONObject();
            for (String colLabel : columnLabels) {
                // 大写转换成驼峰写法
                row.put(Utils.toCamelCase(colLabel), rowSet.getObject(colLabel));
            }
            columnBodys.add(row);
        }
        result = JSON.parseArray(JSON.toJSONString(columnBodys), BillDigestVo.class);
        return result;
    }

//这个里billEntity就是实体全路径
 List<BillDigestVo> billDigestVoList = AssignUtil.queryBillDetails(ctx, billEntity);
                SelectorItemCollection sic = new SelectorItemCollection();
                for (BillDigestVo billDigestVo : billDigestVoList){
                    String propertyGroup = billDigestVo.getPropertyGroup();
                    String propertyName = billDigestVo.getPropertyName();
                    String queryFiled = propertyName;
                    if (Utils.isNotEmpty(propertyGroup)){
                        queryFiled = propertyGroup + "." + propertyName;
                    }
                    sic.add(new SelectorItemInfo(queryFiled));
                }
                sic.add(new SelectorItemInfo("creator.name"));
                sic.add(new SelectorItemInfo("creator.person.number"));
                sic.add(new SelectorItemInfo("createtime"));

//让后使用下面语句查询即可获取需要的字段
  PaymentBillInfo info = PaymentBillFactory.getLocalInstance(ctx).getPaymentBillInfo(new ObjectUuidPK(billId), sic);

 

posted @ 2025-11-04 21:58  凉了记忆  阅读(13)  评论(0)    收藏  举报