报表语义模型(数据加工:返回结果集方式)
数据加工方式:1.返回查询SQL ; 2.返回结果集DataSet;3.返回数据表。 实现方式基本一致,可以参照系统原有报表语义模型
一、 新建报表查询入口类,初始化报表字段
1. 数据加工查询业务处理接口的定义:
package nc.itf.fbm.paperbill.query;
import nc.pub.smart.data.DataSet; import nc.vo.pub.BusinessException;
import com.ufida.dataset.IContext;
/**票据信息查询/票据池额度查询接口 *
* @author 温燕荣WYR * @date 2014-04-15 */
public interface IFbmQueryPaperBillService { /**
* 票据信息查询 * @param context * @return
* @throws BusinessException */
public DataSet queryPaperBillInfo(IContext context) throws Exception; /**
* 票据池额度查询接口 * @param context * @return
* @throws BusinessException */
public DataSet queryPaperBillPoolLimit(IContext context) throws Exception;
}
2. 数据加工入口类,初始化报表字段 package nc.itf.fbm.paperbill.query;
import java.util.ArrayList; import java.util.List;
import nc.bs.framework.common.NCLocator; import nc.pub.smart.data.DataSet;
import nc.pub.smart.metadata.DataTypeConstant; import nc.pub.smart.metadata.Field; import nc.pub.smart.metadata.MetaData;
import nc.vo.obm.paperbill.query.PaperBillPoolVO;
import com.ufida.dataset.IContext;
/**票据池额度查询入口类 *
* @author 温燕荣WYR * @date 2014-04-15 */
public class QueryPaperPoolLimitService { private static final MetaData metaData; public QueryPaperPoolLimitService(){ super(); } /** * 获得结果集 * * @param context 报表界面查询传进来的参数(查询条件=值,系统一些默认参数等) * @return */ public static DataSet queryPJCAmt(IContext context)throws Exception { //调用报表查询业务处理接口, IFbmQueryPaperBillService gatherservice=(IFbmQueryPaperBillService) NCLocator.getInstance().lookup(IFbmQueryPaperBillService.class.getName()); DataSet resultDataSet = gatherservice.queryPaperBillPoolLimit(context); setPrecision(resultDataSet); return resultDataSet; }
//初始化报表要显示的字段,包括查询条件字段也在内
static { metaData = new MetaData(); List
f.setPrecision(17);
f.setDataType(DataTypeConstant.BIGDECIMAL); f.setScale(4); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.CUSEAMT); f.setCaption(\客户有效开票额度\f.setPrecision(17);
f.setDataType(DataTypeConstant.BIGDECIMAL); f.setScale(4); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.CORNAME); f.setCaption(\分支机构名称\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.CORKAMT); f.setCaption(\分支机构剩余可开票额度\f.setPrecision(17);
f.setDataType(DataTypeConstant.BIGDECIMAL); f.setScale(4); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.REQRESERVED1); f.setCaption(\请求备用字段1\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.REQRESERVED2); f.setCaption(\请求备用字段2\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.REPRESERVED3);
f.setCaption(\响应备用字段3\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.REPRESERVED4); f.setCaption(\响应备用字段4\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
//查询字段 f = new Field();
f.setFldname(PaperBillPoolVO.PK_ORG); f.setCaption(\财务组织PK\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f); f = new Field();
f.setFldname(PaperBillPoolVO.QUERY_ACCTNO); f.setCaption(\账号-查询\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.QUERY_PJCNO); f.setCaption(\票据池编号-查询\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.MFLAG); f.setCaption(\是否票据池主申请账号-查询\f.setPrecision(200);
f.setDataType(DataTypeConstant.STRING); fields.add(f);
f = new Field();
f.setFldname(PaperBillPoolVO.NEXTTAG); f.setCaption(\下页标识-查询\