报表嵌入式分析以及跳转报表和表单原创
2人赞赏了该文章
198次浏览
编辑于2024年09月04日 17:37:10
ccpsp.report.formplugin; kd.bos.ai.util.JsonUtil; kd.bos.algo.DataSet; kd.bos.algo.Row; kd.bos.dataentity.entity.LocaleString; kd.bos.entity.qing.*; kd.bos.form.IFormView; kd.bos.form.IPageCache; kd.bos.form.ShowType; kd.bos.form.control.IQingAnalysis; kd.bos.form.plugin.AbstractFormPlugin; kd.bos.logging.Log; kd.bos.logging.LogFactory; kd.bos.mvc.SessionManager; kd.bos.report.ReportShowParameter; kd.bos.servicehelper.QueryServiceHelper; java.math.BigDecimal; java.util.ArrayList; java.util.HashMap; java.util.List; java.util.Map; EachunitpaymentexeCardRptIQingDataProvider AbstractFormPlugin IQingDataProvider { Log = LogFactory.(EachunitpaymentexeCardRptIQingDataProvider.); QingMeta (String pageId) { String entityKey = ; QingMeta meta = QingMeta(); EntryEntity entity = EntryEntity(); entity.setKey(entityKey); entity.setName(LocaleString()); entity.setPkFieldName(); meta.addEntryEntity(entity); Field column = Field(); column.setEntity(entityKey); column.setKey(); column.setFieldType(QingFieldType..toNumber()); column.setName(LocaleString()); meta.addColumn(column); column = Field(); column.setEntity(entityKey); column.setKey(); column.setFieldType(QingFieldType..toNumber()); column.setName(LocaleString()); meta.addColumn(column); column = Field(); column.setEntity(entityKey); column.setKey(); column.setFieldType(QingFieldType..toNumber()); column.setName(LocaleString()); meta.addColumn(column); column = Field(); column.setEntity(entityKey); column.setKey(); column.setFieldType(QingFieldType..toNumber()); column.setName(LocaleString()); meta.addColumn(column); column = Field(); column.setEntity(entityKey); column.setKey(); column.setFieldType(QingFieldType..toNumber()); column.setName(LocaleString()); meta.addColumn(column); meta; } QingData (String pageId, startRow, limit) { getPageCache().get(); QingData data = ; (startRow < ) { data = QingData(); Map<String, Integer> dataindex = HashMap<String, Integer>(); dataindex.put(, ); dataindex.put(, ); dataindex.put(, ); dataindex.put(, ); dataindex.put(, ); data.setDataindex(dataindex); List<Object[]> rows = ArrayList<Object[]>(); DataSet dataSet = QueryServiceHelper.(.getClass().toString(), , + + , , ); (Row row1 : dataSet) { Object[] row = Object[dataindex.size()]; Long payorfid = row1.getLong(); row[] = payorfid; Long supplier = row1.getLong(); row[] = supplier; Long paycurrency = row1.getLong(); row[] = paycurrency; BigDecimal amountcopy = row1.getBigDecimal(); row[] = amountcopy; BigDecimal amountpaid = row1.getBigDecimal(); row[] = amountpaid; rows.add(row); } data.setRows(rows); } data; } String () { getPageCache().get(); } (String filterParameter) { IPageCache pageCache = getPageCache(); pageCache.put(, filterParameter); } List<QingLinkageInfo> (String pageId, String ctrKey) { .info(); ArrayList<QingLinkageInfo> infos = ArrayList<>(); QingLinkageInfo info = QingLinkageInfo(); HashMap<String, String> fromKey = HashMap<>(); fromKey.put(, ); fromKey.put(, ); fromKey.put(, ); fromKey.put(, ctrKey); info.setFormKey(JsonUtil.(fromKey)); info.setFormDisplayName(); info.setFormPrimaryKey(); infos.add(info); .getView().getPageCache().put(, ctrKey); .info(); .info(); infos; } (List<String> ids, String pageId, String formId, String appId) { .info(); ReportShowParameter parameter = ReportShowParameter(); parameter.setFormId(formId); parameter.getOpenStyle().setShowType(ShowType.); IFormView view = SessionManager.().getView(pageId); String ctrKey = .getView().getPageCache().get(); .info(+ ctrKey); (ctrKey != ) { .info(); (view.getControl(ctrKey) IQingAnalysis) { .info(); view.showForm(parameter); .info(); ; } } .getView().setClientReturnData(ReportShowParameter.(parameter)); .info(); } } 表单插件: package ccpsp.report.formplugin; import kd.bos.entity.IFrameMessage; import kd.bos.entity.report.FilterItemInfo; import kd.bos.entity.report.ReportQueryParam; import kd.bos.form.control.IFrame; import kd.bos.portal.util.SerializationUtils; import kd.bos.report.plugin.AbstractReportFormPlugin; import java.util.HashMap; import java.util.Map; /** * @ClassName EachunitpaymentexecRptFormPlugin 各单位付款计划执行率卡片表单插件 * @Description TODO 1.与轻分析控件联动 * @Author pqy * @Date 2024/8/14 下午4:15 * @Version 1.0 */ public class EachunitpaymentexeCardRptFormPlugin extends AbstractReportFormPlugin { @Override public void initDefaultQueryParam(ReportQueryParam queryParam) { // TODO Auto-generated method stub super.initDefaultQueryParam(queryParam); } @Override public void beforeQuery(ReportQueryParam param) { super.beforeQuery(param); Map<String, Object> paramMap = transQueryParam(param); getPageCache().put("qFilter", SerializationUtils.toJsonString(paramMap)); } @Override public void afterQuery(ReportQueryParam queryParam) { // TODO Auto-generated method stub super.afterQuery(queryParam); IFrameMessage message = new IFrameMessage(); message.setType("reExtractData"); IFrame qinganalysisap = (IFrame) this.getView().getControl("ju21_qinganalysisap"); qinganalysisap.postMessage(message); } protected Map<String, Object> transQueryParam(ReportQueryParam param) { Map<String, Object> paramMap = new HashMap(); for (FilterItemInfo filterItem : param.getFilter().getFilterItems()) { paramMap.put(filterItem.getPropName(), filterItem.getValue()); } return paramMap; } }
表单和取数插件代码.zip(3.21KB)
赞 2
2人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!