应收票据台账报表插件7+添加报表工具类
This commit is contained in:
parent
0f66629e8b
commit
119ef80ad6
|
@ -28,33 +28,10 @@ public class AccountbankReportPlugin extends AbstractReportListDataPlugin {
|
|||
|
||||
private static final Log logger = LogFactory.getLog(AccountbankReportPlugin.class);
|
||||
|
||||
public List<QFilter> getListQFilter(ReportQueryParam reportQueryParam) {
|
||||
//过滤条件数组
|
||||
ArrayList<QFilter> filters = new ArrayList<>();
|
||||
//初始化过滤数据
|
||||
List<FilterItemInfo> initFilter = reportQueryParam.getFilter().getFilterItems();
|
||||
if (CollectionUtils.isNotEmpty(initFilter)) {
|
||||
for (FilterItemInfo filterItemInfo : initFilter) {
|
||||
// QFilter filter = new QFilter(filterItemInfo.getPropName(), filterItemInfo.getCompareType(), filterItemInfo.getValue());
|
||||
QFilter filter = new QFilter(filterItemInfo.getPropName(), QCP.equals, filterItemInfo.getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
//快速过滤
|
||||
FastFilter fastFilter = reportQueryParam.getFilter().getFastFilter();
|
||||
if (fastFilter != null) {
|
||||
List<QFilter> fastFilterList = reportQueryParam.getFilter().getFastFilter().getQFilters();
|
||||
//添加过滤条件
|
||||
if (CollectionUtils.isNotEmpty(fastFilterList)) {
|
||||
filters.addAll(fastFilterList);
|
||||
}
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
//获取筛选器的值
|
||||
List<QFilter> listQFilter = getListQFilter(reportQueryParam);
|
||||
List<QFilter> listQFilter = ReportUtils.getListQFilter(reportQueryParam);
|
||||
List<String> dateList = new ArrayList<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
for (QFilter filter : listQFilter) {
|
||||
|
@ -77,7 +54,7 @@ public class AccountbankReportPlugin extends AbstractReportListDataPlugin {
|
|||
, null, null);
|
||||
|
||||
String[] fieldNames = accountbankDataSet.getRowMeta().getFieldNames();
|
||||
String[] newFieldNames = ExpansionArray(fieldNames, Arrays.asList("fid", "fbasedataid as shkd_bz"));
|
||||
String[] newFieldNames = ReportUtils.ExpansionArray(fieldNames, Arrays.asList("fid", "fbasedataid as shkd_bz"));
|
||||
|
||||
// 查询多选币别
|
||||
DataSet currencydata = DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("sys"),
|
||||
|
@ -89,7 +66,7 @@ public class AccountbankReportPlugin extends AbstractReportListDataPlugin {
|
|||
|
||||
String[] fieldNames1 = finish.getRowMeta().getFieldNames();
|
||||
|
||||
String[] newFieldNames1 = ExpansionArray(fieldNames1, Arrays.asList("shkd_zhyeyb", "shkd_zhyebb", "shkd_zhyesj"));
|
||||
String[] newFieldNames1 = ReportUtils.ExpansionArray(fieldNames1, Arrays.asList("shkd_zhyeyb", "shkd_zhyebb", "shkd_zhyesj"));
|
||||
//查询余额
|
||||
StringBuilder sqlBuilder = new StringBuilder("/*dialect*/ \n");
|
||||
sqlBuilder.append("SELECT fbankacctid ,SUM(FDebitAmount-FCreditAmount) as shkd_zhyeyb,SUM(FDebitAmount*fexchangerate-FCreditAmount*fexchangerate) as shkd_zhyebb,fcurrencyid,MAX(FBizDate) as shkd_zhyesj\n" +
|
||||
|
@ -103,20 +80,4 @@ public class AccountbankReportPlugin extends AbstractReportListDataPlugin {
|
|||
return finish1;
|
||||
}
|
||||
|
||||
|
||||
String[] ExpansionArray(String[] fieldNames,List<String> list){
|
||||
|
||||
|
||||
// 创建一个新的数组,长度是原数组长度 + 3(因为要添加两个字段)
|
||||
String[] newFieldNames = new String[fieldNames.length + list.size()];
|
||||
|
||||
// 将原来的字段名数组复制到新数组
|
||||
System.arraycopy(fieldNames, 0, newFieldNames, 0, fieldNames.length);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
// 添加两个新的字段到新数组的末尾
|
||||
newFieldNames[fieldNames.length+i] = list.get(i); // 第i个新字段
|
||||
}
|
||||
return newFieldNames;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,35 +14,44 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报表界面插件
|
||||
* 应收票据台账报表查询插件
|
||||
*/
|
||||
public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin {
|
||||
|
||||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
String selectFields = "id,company.name as shkd_skdw,bizdate as shkd_spyf,bizdate as shkd_sprq,draftbillno as shkd_pjhm," +
|
||||
|
||||
List<QFilter> listQFilter = ReportUtils.getListQFilter(reportQueryParam);
|
||||
|
||||
String selectFields = "id,company as shkd_skdw,bizdate as shkd_spyf,bizdate as shkd_sprq,draftbillno as shkd_pjhm," +
|
||||
"amount as shkd_hpje,availableamount as shkd_kyje,drawername as shkd_cprqc,delivername as shkd_jprqcqs," +
|
||||
"acceptername as shkd_cdrqc,issuedate as shkd_cprq, draftbillexpiredate as shkd_pjdqr";
|
||||
DataSet draftBillData = QueryServiceHelper.queryDataSet(this.getClass().getSimpleName(),"cdm_receivablebill",
|
||||
selectFields, new QFilter[]{new QFilter("source", QCP.not_equals,"cdm")}, null);
|
||||
String[] fieldNames = draftBillData.getRowMeta().getFieldNames();
|
||||
String[] newFieldNames1 = ExpansionArray(fieldNames, Arrays.asList("shkd_txrq", "shkd_txjg","shkd_txje"));
|
||||
String[] newFieldNames2 = ExpansionArray(newFieldNames1, Arrays.asList("shkd_tsrq", "shkd_tsyh","shkd_tsje"));
|
||||
String[] newFieldNames3 = ExpansionArray(newFieldNames2, Arrays.asList("shkd_bsrq", "shkd_bsr","shkd_bsje"));
|
||||
String[] newFieldNames4 = ExpansionArray(newFieldNames3, Arrays.asList("shkd_zyrq", "shkd_zyr","shkd_yzyje"));
|
||||
String[] newFieldNames1 = ReportUtils.ExpansionArray(fieldNames, Arrays.asList("shkd_txrq", "shkd_txjg","shkd_txje"));
|
||||
String[] newFieldNames2 = ReportUtils.ExpansionArray(newFieldNames1, Arrays.asList("shkd_tsrq", "shkd_tsyh","shkd_tsje"));
|
||||
String[] newFieldNames3 = ReportUtils.ExpansionArray(newFieldNames2, Arrays.asList("shkd_bsrq", "shkd_bsr","shkd_bsje"));
|
||||
String[] newFieldNames4 = ReportUtils.ExpansionArray(newFieldNames3, Arrays.asList("shkd_zyrq", "shkd_zyr","shkd_yzyje"));
|
||||
|
||||
DataSet disCountData = getDisCountData();
|
||||
DataSet pledgeData = getPledgeData();
|
||||
DataSet endorseData = getEndorseData();
|
||||
DataSet collectData = getCollectData();
|
||||
DataSet draftBillData2 = QueryServiceHelper.queryDataSet(this.getClass().getSimpleName(),"cdm_receivablebill",
|
||||
"id,draftbilltype.name as shkd_pjlx,description as shkd_skkxxz,description as shkd_bz", new QFilter[]{new QFilter("source", QCP.not_equals,"cdm")}, null);
|
||||
String[] newFieldNames5 = ReportUtils.ExpansionArray(newFieldNames4, Arrays.asList("shkd_pjlx", "shkd_skkxxz","shkd_bz"));
|
||||
|
||||
return draftBillData.join(disCountData, JoinType.LEFT)
|
||||
.on("shkd_id","pjid3").select(newFieldNames1).finish()
|
||||
.on("id","pjid3").select(newFieldNames1).finish()
|
||||
.join(collectData, JoinType.LEFT)
|
||||
.on("shkd_id","pjid1").select(newFieldNames2).finish()
|
||||
.on("id","pjid1").select(newFieldNames2).finish()
|
||||
.join(endorseData, JoinType.LEFT)
|
||||
.on("shkd_id","pjid2").select(newFieldNames3).finish()
|
||||
.on("id","pjid2").select(newFieldNames3).finish()
|
||||
.join(pledgeData, JoinType.LEFT)
|
||||
.on("shkd_id","pjid4").select(newFieldNames4).finish();
|
||||
.on("id","pjid4").select(newFieldNames4).finish()
|
||||
.join(draftBillData2, JoinType.LEFT)
|
||||
.on("id","id").select(newFieldNames5).finish();
|
||||
}
|
||||
|
||||
//贴现
|
||||
|
@ -52,8 +61,8 @@ public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin
|
|||
" pjid3,\n" +
|
||||
" MAX(discountid) AS discountid,\n" +
|
||||
" MAX(discounttradetype) AS discounttradetype,\n" +
|
||||
" LISTAGG(TO_CHAR(bizdate, 'YYYY-MM-DD'),';') WITHIN GROUP (ORDER BY bizdate ASC) AS shkd_txrq, \n" +
|
||||
" LISTAGG(disfrecbodyname || ';' || TO_CHAR(discamt, '999,999,999,999.99'),';') \n" +
|
||||
" LISTAGG(TO_CHAR(bizdate, 'YYYY-MM-DD'),'\n') WITHIN GROUP (ORDER BY bizdate ASC) AS shkd_txrq, \n" +
|
||||
" LISTAGG(disfrecbodyname || ';' || TO_CHAR(discamt, '999,999,999,999.99'),'\n') \n" +
|
||||
" WITHIN GROUP (ORDER BY bizdate ASC) AS shkd_txjg,\n" +
|
||||
" SUM(discamt) AS shkd_txje\n" +
|
||||
" FROM (\n" +
|
||||
|
@ -85,8 +94,8 @@ public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin
|
|||
" pjid2,\n" +
|
||||
" MAX(discountid) AS discountid,\n" +
|
||||
" MAX(discounttradetype) AS discounttradetype,\n" +
|
||||
" LISTAGG(TO_CHAR(bizdate, 'YYYY-MM-DD'), ';') WITHIN GROUP (ORDER BY bizdate ASC) AS shkd_bsrq,\n" +
|
||||
" LISTAGG(endorsename || ';' || TO_CHAR(endorseamt, '999,999,999,999.99'), ';') WITHIN GROUP " +
|
||||
" LISTAGG(TO_CHAR(bizdate, 'YYYY-MM-DD'), '\n') WITHIN GROUP (ORDER BY bizdate ASC) AS shkd_bsrq,\n" +
|
||||
" LISTAGG(endorsename || ';' || TO_CHAR(endorseamt, '999,999,999,999.99'), '\n') WITHIN GROUP " +
|
||||
" (ORDER BY bizdate ASC) AS shkd_bsr,\n" +
|
||||
" SUM(endorseamt) AS shkd_bsje\n" +
|
||||
" FROM (\n" +
|
||||
|
@ -135,10 +144,10 @@ public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin
|
|||
" MAX(t2id4) AS t2id4,\n" +
|
||||
" MAX(tradetype4) AS tradetype4,\n" +
|
||||
" LISTAGG(\n" +
|
||||
" TO_CHAR(bizdate, 'YYYY-MM-DD'),';' \n" +
|
||||
" TO_CHAR(bizdate, 'YYYY-MM-DD'),'\n' \n" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate ASC) AS shkd_zyrq,\n" +
|
||||
" LISTAGG(\n" +
|
||||
" pledgename || ';' || TO_CHAR(pledgeamt, '999,999,999,999.99'),';'\n" +
|
||||
" pledgename || ';' || TO_CHAR(pledgeamt, '999,999,999,999.99'),'\n'\n" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate ASC) AS shkd_zyr,\n" +
|
||||
" SUM(pledgeamt) AS shkd_yzyje\n" +
|
||||
" FROM (\n" +
|
||||
|
@ -159,18 +168,5 @@ public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin
|
|||
}
|
||||
|
||||
|
||||
private String[] ExpansionArray(String[] fieldNames, List<String> list){
|
||||
|
||||
// 创建一个新的数组
|
||||
String[] newFieldNames = new String[fieldNames.length + list.size()];
|
||||
|
||||
// 将原来的字段名数组复制到新数组
|
||||
System.arraycopy(fieldNames, 0, newFieldNames, 0, fieldNames.length);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
// 添加两个新的字段到新数组的末尾
|
||||
newFieldNames[fieldNames.length+i] = list.get(i); // 第i个新字段
|
||||
}
|
||||
return newFieldNames;
|
||||
}
|
||||
}
|
|
@ -36,35 +36,11 @@ import java.util.stream.Collectors;
|
|||
public class FinanceReportPlugin extends AbstractReportListDataPlugin {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(FinanceReportPlugin.class);
|
||||
public List<QFilter> getListQFilter(ReportQueryParam reportQueryParam) {
|
||||
//过滤条件数组
|
||||
ArrayList<QFilter> filters = new ArrayList<>();
|
||||
//初始化过滤数据
|
||||
List<FilterItemInfo> initFilter = reportQueryParam.getFilter().getFilterItems();
|
||||
if (CollectionUtils.isNotEmpty(initFilter)) {
|
||||
for (FilterItemInfo filterItemInfo : initFilter) {
|
||||
// QFilter filter = new QFilter(filterItemInfo.getPropName(), filterItemInfo.getCompareType(), filterItemInfo.getValue());
|
||||
QFilter filter = new QFilter(filterItemInfo.getPropName(), QCP.equals, filterItemInfo.getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
//快速过滤
|
||||
FastFilter fastFilter = reportQueryParam.getFilter().getFastFilter();
|
||||
if (fastFilter != null) {
|
||||
List<QFilter> fastFilterList = reportQueryParam.getFilter().getFastFilter().getQFilters();
|
||||
//添加过滤条件
|
||||
if (CollectionUtils.isNotEmpty(fastFilterList)) {
|
||||
filters.addAll(fastFilterList);
|
||||
}
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
//获取筛选器的值
|
||||
List<QFilter> listQFilter = getListQFilter(reportQueryParam);
|
||||
List<QFilter> listQFilter = ReportUtils.getListQFilter(reportQueryParam);
|
||||
List<String> dateList = new ArrayList<>();
|
||||
DynamicObject selorgDy = null;
|
||||
Double shkd_selmoney=0.0;
|
||||
|
|
|
@ -33,33 +33,10 @@ public class FinanceReportfordatePlugin extends AbstractReportListDataPlugin {
|
|||
|
||||
private static final Log logger = LogFactory.getLog(FinanceReportfordatePlugin.class);
|
||||
|
||||
public List<QFilter> getListQFilter(ReportQueryParam reportQueryParam) {
|
||||
//过滤条件数组
|
||||
ArrayList<QFilter> filters = new ArrayList<>();
|
||||
//初始化过滤数据
|
||||
List<FilterItemInfo> initFilter = reportQueryParam.getFilter().getFilterItems();
|
||||
if (CollectionUtils.isNotEmpty(initFilter)) {
|
||||
for (FilterItemInfo filterItemInfo : initFilter) {
|
||||
// QFilter filter = new QFilter(filterItemInfo.getPropName(), filterItemInfo.getCompareType(), filterItemInfo.getValue());
|
||||
QFilter filter = new QFilter(filterItemInfo.getPropName(), QCP.equals, filterItemInfo.getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
//快速过滤
|
||||
FastFilter fastFilter = reportQueryParam.getFilter().getFastFilter();
|
||||
if (fastFilter != null) {
|
||||
List<QFilter> fastFilterList = reportQueryParam.getFilter().getFastFilter().getQFilters();
|
||||
//添加过滤条件
|
||||
if (CollectionUtils.isNotEmpty(fastFilterList)) {
|
||||
filters.addAll(fastFilterList);
|
||||
}
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
//获取筛选器的值
|
||||
List<QFilter> listQFilter = getListQFilter(reportQueryParam);
|
||||
List<QFilter> listQFilter = ReportUtils.getListQFilter(reportQueryParam);
|
||||
String shkd_selstartdate="";
|
||||
String shkd_selenddate="";
|
||||
List<String> dateList = new ArrayList<>();
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package shkd.sys.sys.plugin.report;
|
||||
|
||||
import kd.bos.entity.report.FastFilter;
|
||||
import kd.bos.entity.report.FilterItemInfo;
|
||||
import kd.bos.entity.report.ReportQueryParam;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ReportUtils {
|
||||
public static String[] ExpansionArray(String[] fieldNames, List<String> list){
|
||||
|
||||
// 创建一个新的数组,添加其它dataSet所需字段
|
||||
String[] newFieldNames = new String[fieldNames.length + list.size()];
|
||||
|
||||
// 将原来的字段名数组复制到新数组
|
||||
System.arraycopy(fieldNames, 0, newFieldNames, 0, fieldNames.length);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
// 添加两个新的字段到新数组的末尾
|
||||
newFieldNames[fieldNames.length+i] = list.get(i); // 第i个新字段
|
||||
}
|
||||
return newFieldNames;
|
||||
}
|
||||
|
||||
public static List<QFilter> getListQFilter(ReportQueryParam reportQueryParam) {
|
||||
//过滤条件数组
|
||||
ArrayList<QFilter> filters = new ArrayList<>();
|
||||
//初始化过滤数据
|
||||
List<FilterItemInfo> initFilter = reportQueryParam.getFilter().getFilterItems();
|
||||
if (CollectionUtils.isNotEmpty(initFilter)) {
|
||||
for (FilterItemInfo filterItemInfo : initFilter) {
|
||||
// QFilter filter = new QFilter(filterItemInfo.getPropName(), filterItemInfo.getCompareType(), filterItemInfo.getValue());
|
||||
QFilter filter = new QFilter(filterItemInfo.getPropName(), QCP.equals, filterItemInfo.getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
//快速过滤
|
||||
FastFilter fastFilter = reportQueryParam.getFilter().getFastFilter();
|
||||
if (fastFilter != null) {
|
||||
List<QFilter> fastFilterList = reportQueryParam.getFilter().getFastFilter().getQFilters();
|
||||
//添加过滤条件
|
||||
if (CollectionUtils.isNotEmpty(fastFilterList)) {
|
||||
filters.addAll(fastFilterList);
|
||||
}
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue