parent
c876302e05
commit
2f41312927
|
@ -0,0 +1,312 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package shkd.sys.sys.plugin.report;
|
||||
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.resource.ResManager;
|
||||
import kd.bos.entity.EntityMetadataCache;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.entity.report.AbstractReportColumn;
|
||||
import kd.bos.entity.report.IReportListModel;
|
||||
import kd.bos.entity.report.ReportColumn;
|
||||
import kd.bos.entity.report.ReportQueryParam;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.events.HyperLinkClickEvent;
|
||||
import kd.bos.form.events.HyperLinkClickListener;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.report.ReportList;
|
||||
import kd.bos.report.ReportShowParameter;
|
||||
import kd.bos.report.filter.ReportFilter;
|
||||
import kd.bos.report.plugin.AbstractReportFormPlugin;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.tmc.fbp.common.helper.SnapDataHelper;
|
||||
import kd.tmc.fbp.common.helper.TmcOrgDataHelper;
|
||||
import kd.tmc.fbp.common.util.EmptyUtil;
|
||||
import kd.tmc.fca.common.enums.StatisCycleEnum;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class transbillreportnewFormPlugin extends AbstractReportFormPlugin implements HyperLinkClickListener {
|
||||
private static final String SYSTEM_TYPE = "tmc-fca-report";
|
||||
private static final String[] BANK_DIMENSION = new String[]{"sumlevel", "parentorg", "parentorgid", "bank", "bankid", "statcurrency", "upamount", "downamount", "differenceamount"};
|
||||
private static final String[] SON_ORG_DIMENSION = new String[]{"sumlevel", "parentorg", "parentorgid", "sonorg", "sonorgid", "statcurrency", "upamount", "downamount", "differenceamount"};
|
||||
|
||||
public transbillreportnewFormPlugin() {
|
||||
}
|
||||
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
ReportList reportlist = (ReportList)this.getView().getControl("reportlistap");
|
||||
reportlist.addHyperClickListener(this);
|
||||
BasedataEdit accountGroup = (BasedataEdit)this.getControl("filter_accountgroup");
|
||||
accountGroup.addBeforeF7SelectListener((evt) -> {
|
||||
DynamicObjectCollection parentOrg = (DynamicObjectCollection)this.getModel().getValue("filter_org");
|
||||
if (parentOrg != null && !parentOrg.isEmpty()) {
|
||||
List<Object> orgIdList = (List)parentOrg.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).collect(Collectors.toList());
|
||||
evt.getCustomQFilters().add(new QFilter("company", "in", orgIdList));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void initDefaultQueryParam(ReportQueryParam queryParam) {
|
||||
List<Long> authOrgList = TmcOrgDataHelper.getAuthorizedBankOrgId(RequestContext.get().getCurrUserId(), this.getView().getFormShowParameter().getAppId(), this.getModel().getDataEntityType().getName(), "47150e89000000ac");
|
||||
BasedataEdit org = (BasedataEdit)this.getControl("filter_org");
|
||||
org.setQFilter(new QFilter("id", "in", this.getAuthParentOrgList(authOrgList)));
|
||||
BasedataEdit sonOrg = (BasedataEdit)this.getControl("filter_sonorg");
|
||||
sonOrg.setQFilter(new QFilter("id", "in", this.getAuthSonOrgList(authOrgList)));
|
||||
BasedataEdit currency = (BasedataEdit)this.getControl("filter_currency");
|
||||
currency.setQFilter(new QFilter("id", "in", this.getCurrencyIdList()));
|
||||
BasedataEdit bank = (BasedataEdit)this.getControl("filter_bank");
|
||||
bank.setQFilter(new QFilter("id", "in", this.getBankIdList(authOrgList)));
|
||||
BasedataEdit accountGroup = (BasedataEdit)this.getControl("filter_accountgroup");
|
||||
accountGroup.setQFilter(new QFilter("id", "in", this.getAccountGroupIdList(authOrgList)));
|
||||
this.setDefaultOrg();
|
||||
}
|
||||
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
switch (e.getProperty().getName()) {
|
||||
case "filter_dimension":
|
||||
ReportFilter rptFilter = (ReportFilter)this.getControl("reportfilterap");
|
||||
rptFilter.search();
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public boolean verifyQuery(ReportQueryParam param) {
|
||||
Map<String, Object> paramMap = SnapDataHelper.transQueryParam(param);
|
||||
String filterPeriod = (String)paramMap.get("filter_period");
|
||||
if (EmptyUtil.isEmpty(filterPeriod)) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("统计周期条件不能为空。", "TransBillReportFormListPlugin_0", "tmc-fca-report", new Object[0]));
|
||||
return false;
|
||||
} else if (!Objects.equals(StatisCycleEnum.CONSTOM.getCode(), filterPeriod) || paramMap.get("filter_startdate") != null && paramMap.get("filter_enddate") != null) {
|
||||
if (EmptyUtil.isEmpty(this.getModel().getValue("filter_statcurrency"))) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("统计币种不能为空。", "TransBillReportFormListPlugin_3", "tmc-fca-report", new Object[0]));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("起止日期条件不能为空。", "TransBillReportFormListPlugin_1", "tmc-fca-report", new Object[0]));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void beforeQuery(ReportQueryParam queryParam) {
|
||||
super.beforeQuery(queryParam);
|
||||
String dimension = (String)this.getModel().getValue("filter_dimension");
|
||||
queryParam.getFilter().addFilterItem("filter_dimension", dimension);
|
||||
if ("bank".equals(dimension)) {
|
||||
this.rebuildColumn(BANK_DIMENSION);
|
||||
} else {
|
||||
this.rebuildColumn(SON_ORG_DIMENSION);
|
||||
}
|
||||
|
||||
DynamicObjectCollection sonOrg = (DynamicObjectCollection)this.getModel().getValue("filter_sonorg");
|
||||
if (sonOrg != null && !sonOrg.isEmpty()) {
|
||||
List<Object> orgIdList = (List)sonOrg.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).collect(Collectors.toList());
|
||||
queryParam.getFilter().getFilterItem("filter_sonorg").setValue(orgIdList);
|
||||
}
|
||||
|
||||
DynamicObjectCollection accountGroup = (DynamicObjectCollection)this.getModel().getValue("filter_accountgroup");
|
||||
List authOrgList;
|
||||
if (accountGroup != null && !accountGroup.isEmpty()) {
|
||||
authOrgList = (List)accountGroup.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).collect(Collectors.toList());
|
||||
queryParam.getFilter().getFilterItem("filter_accountgroup").setValue(authOrgList);
|
||||
}
|
||||
|
||||
authOrgList = TmcOrgDataHelper.getAuthorizedBankOrgId(RequestContext.get().getCurrUserId(), this.getView().getFormShowParameter().getAppId(), this.getModel().getDataEntityType().getName(), "47150e89000000ac");
|
||||
queryParam.getFilter().addFilterItem("orgIdList", this.getAuthParentOrgList(authOrgList));
|
||||
}
|
||||
|
||||
public void hyperLinkClick(HyperLinkClickEvent evt) {
|
||||
String field = evt.getFieldName();
|
||||
if ("upamount".equals(field) || "downamount".equals(field) || "differenceamount".equals(field)) {
|
||||
int rowIndex = evt.getRowIndex();
|
||||
ReportList reportList = (ReportList)evt.getSource();
|
||||
IReportListModel reportModel = reportList.getReportModel();
|
||||
DynamicObject rowData = reportModel.getRowData(rowIndex);
|
||||
ReportShowParameter param = new ReportShowParameter();
|
||||
DynamicObjectCollection currency;
|
||||
Object[] currencyIds;
|
||||
if (EmptyUtil.isNoEmpty(rowData.get("parentorgid"))) {
|
||||
param.getCustomParams().put("filter_org", new Object[]{rowData.get("parentorgid")});
|
||||
} else {
|
||||
currency = (DynamicObjectCollection)this.getModel().getValue("filter_org");
|
||||
if (currency != null && !currency.isEmpty()) {
|
||||
currencyIds = currency.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).toArray();
|
||||
param.getCustomParams().put("filter_org", currencyIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (EmptyUtil.isNoEmpty(rowData.get("bankid"))) {
|
||||
param.getCustomParams().put("filter_bank", new Object[]{rowData.get("bankid")});
|
||||
} else {
|
||||
currency = (DynamicObjectCollection)this.getModel().getValue("filter_bank");
|
||||
if (currency != null && !currency.isEmpty()) {
|
||||
currencyIds = currency.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).toArray();
|
||||
param.getCustomParams().put("filter_bank", currencyIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (EmptyUtil.isNoEmpty(rowData.get("sonorgid"))) {
|
||||
param.getCustomParams().put("filter_sonorg", new Object[]{rowData.get("sonorgid")});
|
||||
} else {
|
||||
currency = (DynamicObjectCollection)this.getModel().getValue("filter_sonorg");
|
||||
if (currency != null && !currency.isEmpty()) {
|
||||
currencyIds = currency.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).toArray();
|
||||
param.getCustomParams().put("filter_sonorg", currencyIds);
|
||||
}
|
||||
}
|
||||
|
||||
currency = (DynamicObjectCollection)this.getModel().getValue("filter_currency");
|
||||
if (currency != null && !currency.isEmpty()) {
|
||||
currencyIds = currency.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).toArray();
|
||||
param.getCustomParams().put("filter_currency", currencyIds);
|
||||
}
|
||||
|
||||
DynamicObjectCollection accountGroup = (DynamicObjectCollection)this.getModel().getValue("filter_accountgroup");
|
||||
if (accountGroup != null && !accountGroup.isEmpty()) {
|
||||
Object[] accountGroupIds = accountGroup.stream().map((v) -> {
|
||||
return v.getDynamicObject("fbasedataid").getPkValue();
|
||||
}).toArray();
|
||||
param.getCustomParams().put("filter_accountgroup", accountGroupIds);
|
||||
}
|
||||
|
||||
if ("upamount".equals(field)) {
|
||||
param.getCustomParams().put("filter_biztype", "fca_transupbill");
|
||||
} else if ("downamount".equals(field)) {
|
||||
param.getCustomParams().put("filter_biztype", "fca_transdownbill");
|
||||
}
|
||||
|
||||
param.getCustomParams().put("filter_period", this.getModel().getValue("filter_period"));
|
||||
param.getCustomParams().put("filter_startdate", this.getModel().getValue("filter_startdate"));
|
||||
param.getCustomParams().put("filter_enddate", this.getModel().getValue("filter_enddate"));
|
||||
param.getCustomParams().put("filter_statcurrency", ((DynamicObject)rowData.get("statcurrency")).getPkValue());
|
||||
param.getCustomParams().put("filter_currencyunit", this.getModel().getValue("filter_currencyunit"));
|
||||
param.setFormId("transbill_detail_report");
|
||||
param.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
||||
this.getView().showForm(param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<Long> getAuthParentOrgList(List<Long> authOrgList) {
|
||||
QFilter companyIdFilter = new QFilter("company", "in", authOrgList);
|
||||
DynamicObjectCollection groupAccount = QueryServiceHelper.query("fca_acctgroup", "company", new QFilter[]{companyIdFilter});
|
||||
return (List)groupAccount.stream().map((g) -> {
|
||||
return g.getLong("company");
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Long> getAuthSonOrgList(List<Long> authOrgList) {
|
||||
QFilter companyIdFilter = new QFilter("entrys.bankacct.company", "in", authOrgList);
|
||||
DynamicObjectCollection groupAccount = QueryServiceHelper.query("fca_acctgroup", "entrys.bankacct.company", new QFilter[]{companyIdFilter});
|
||||
return (List)groupAccount.stream().map((g) -> {
|
||||
return g.getLong("entrys.bankacct.company");
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Long> getCurrencyIdList() {
|
||||
QFilter filter = new QFilter("1", "=", 1);
|
||||
DynamicObjectCollection groupAccount = QueryServiceHelper.query("fca_acctgroup", "currency", new QFilter[]{filter});
|
||||
return (List)groupAccount.stream().map((g) -> {
|
||||
return g.getLong("currency");
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Long> getBankIdList(List<Long> authOrgList) {
|
||||
QFilter companyIdFilter = new QFilter("company", "in", authOrgList);
|
||||
DynamicObjectCollection groupAccount = QueryServiceHelper.query("fca_acctgroup", "accountbank.bank.id", new QFilter[]{companyIdFilter});
|
||||
return (List)groupAccount.stream().map((g) -> {
|
||||
return g.getLong("accountbank.bank.id");
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Long> getAccountGroupIdList(List<Long> authOrgList) {
|
||||
QFilter companyIdFilter = new QFilter("company", "in", authOrgList);
|
||||
DynamicObjectCollection groupAccount = QueryServiceHelper.query("fca_acctgroup", "id", new QFilter[]{companyIdFilter});
|
||||
return (List)groupAccount.stream().map((g) -> {
|
||||
return g.getLong("id");
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void rebuildColumn(String[] fields) {
|
||||
ReportList listTable = (ReportList)this.getView().getControl("reportlistap");
|
||||
if (fields != null && fields.length >= 1) {
|
||||
List<AbstractReportColumn> columns = listTable.getColumns();
|
||||
List<AbstractReportColumn> rebuildColumns = new ArrayList(fields.length);
|
||||
String[] var5 = fields;
|
||||
int var6 = fields.length;
|
||||
|
||||
for(int var7 = 0; var7 < var6; ++var7) {
|
||||
String s = var5[var7];
|
||||
String field = s.trim();
|
||||
Iterator var10 = columns.iterator();
|
||||
|
||||
while(var10.hasNext()) {
|
||||
AbstractReportColumn absColumn = (AbstractReportColumn)var10.next();
|
||||
ReportColumn column = (ReportColumn)absColumn;
|
||||
if (column.getFieldKey().equalsIgnoreCase(field)) {
|
||||
rebuildColumns.add(column);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!rebuildColumns.isEmpty()) {
|
||||
columns.clear();
|
||||
columns.addAll(rebuildColumns);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefaultOrg() {
|
||||
Long org = RequestContext.get().getOrgId();
|
||||
String appId = this.getView().getFormShowParameter().getAppId();
|
||||
List<Long> authOrgIds = TmcOrgDataHelper.getAuthorizedBankOrgId(Long.valueOf(RequestContext.get().getUserId()), appId, this.getModel().getDataEntityType().getName(), "47150e89000000ac");
|
||||
this.getModel().setValue("filter_org", (Object)null);
|
||||
if (authOrgIds != null && authOrgIds.size() > 0) {
|
||||
DynamicObject bosOrg;
|
||||
DynamicObjectCollection collection;
|
||||
if (authOrgIds.contains(org)) {
|
||||
bosOrg = BusinessDataServiceHelper.loadSingle(org, EntityMetadataCache.getDataEntityType("bos_org"));
|
||||
collection = new DynamicObjectCollection();
|
||||
collection.add(bosOrg);
|
||||
this.getModel().setValue("filter_org", collection);
|
||||
} else {
|
||||
bosOrg = BusinessDataServiceHelper.loadSingle(authOrgIds.get(0), EntityMetadataCache.getDataEntityType("bos_org"));
|
||||
if (EmptyUtil.isNoEmpty(bosOrg)) {
|
||||
collection = new DynamicObjectCollection();
|
||||
collection.add(bosOrg);
|
||||
this.getModel().setValue("filter_org", collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,192 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package shkd.sys.sys.plugin.report;
|
||||
|
||||
import kd.bos.algo.DataSet;
|
||||
import kd.bos.algo.GroupbyDataSet;
|
||||
import kd.bos.dataentity.entity.DataEntityBase;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.report.ReportQueryParam;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.tmc.fbp.common.util.DateUtils;
|
||||
import kd.tmc.fbp.report.data.AbstractTmcTreeReportDataPlugin;
|
||||
import kd.tmc.fca.common.enums.FcaTransDetailStatusEnum;
|
||||
import kd.tmc.fca.common.enums.FcaTransPayStatusEnum;
|
||||
import kd.tmc.fca.common.enums.StatisCycleEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class transbillreportnewPlugin extends AbstractTmcTreeReportDataPlugin {
|
||||
private static final String UP_BANK_SELECT = "company.name as parentorg, company.id as parentorgid, bank.name as bank, bank.id as bankid, currency, entrys.transamt as upamount, 0 as downamount";
|
||||
private static final String UP_SON_ORG_SELECT = "company.name as parentorg, company.id as parentorgid, entrys.e_useorg.name as sonorg, entrys.e_useorg.id as sonorgid, currency, entrys.transamt as upamount, 0 as downamount";
|
||||
private static final String DOWN_BANK_SELECT = "company.name as parentorg, company.id as parentorgid, bank.name as bank, bank.id as bankid, currency, 0 as upamount, entrys.transamt as downamount";
|
||||
private static final String DOWN_SON_ORG_SELECT = "company.name as parentorg, company.id as parentorgid, entrys.e_useorg.name as sonorg, entrys.e_useorg.id as sonorgid, currency, 0 as upamount, entrys.transamt as downamount";
|
||||
private static final String BANK_SELECT = "parentorg, parentorgid, bank, bankid, upamount_report as upamount, downamount_report as downamount";
|
||||
private static final String SON_ORG_SELECT = "parentorg, parentorgid, sonorg, sonorgid, upamount_report as upamount, downamount_report as downamount";
|
||||
private static final String[] BANK_GROUP_SELECT = new String[]{"parentorg", "parentorgid", "bank", "bankid"};
|
||||
private static final String[] SON_ORG_GROUP_SELECT = new String[]{"parentorg", "parentorgid", "sonorg", "sonorgid"};
|
||||
private List<String> sumAmountFieldList;
|
||||
private String sumNameField;
|
||||
private boolean isCompute = true;
|
||||
|
||||
public transbillreportnewPlugin() {
|
||||
}
|
||||
|
||||
public DataSet queryDataSet(ReportQueryParam reportQueryParam) {
|
||||
Map<String, Object> paramMap = this.transQueryParam(reportQueryParam);
|
||||
QFilter filter = this.initFilter(paramMap);
|
||||
String upSelect;
|
||||
String downSelect;
|
||||
String[] groupSelect;
|
||||
String select;
|
||||
if ("bank".equals(paramMap.get("filter_dimension"))) {
|
||||
upSelect = "company.name as parentorg, company.id as parentorgid, bank.name as bank, bank.id as bankid, currency, entrys.transamt as upamount, 0 as downamount";
|
||||
downSelect = "company.name as parentorg, company.id as parentorgid, bank.name as bank, bank.id as bankid, currency, 0 as upamount, entrys.transamt as downamount";
|
||||
select = "parentorg, parentorgid, bank, bankid, upamount_report as upamount, downamount_report as downamount";
|
||||
groupSelect = BANK_GROUP_SELECT;
|
||||
this.setSumNameField("bank");
|
||||
} else {
|
||||
upSelect = "company.name as parentorg, company.id as parentorgid, entrys.e_useorg.name as sonorg, entrys.e_useorg.id as sonorgid, currency, entrys.transamt as upamount, 0 as downamount";
|
||||
downSelect = "company.name as parentorg, company.id as parentorgid, entrys.e_useorg.name as sonorg, entrys.e_useorg.id as sonorgid, currency, 0 as upamount, entrys.transamt as downamount";
|
||||
select = "parentorg, parentorgid, sonorg, sonorgid, upamount_report as upamount, downamount_report as downamount";
|
||||
groupSelect = SON_ORG_GROUP_SELECT;
|
||||
this.setSumNameField("sonorg");
|
||||
}
|
||||
|
||||
DataSet upDataSet = QueryServiceHelper.queryDataSet("fca_transupbill", "fca_transupbill", upSelect, filter.toArray(), "company");
|
||||
DataSet downDataSet = QueryServiceHelper.queryDataSet("fca_transdownbill", "fca_transdownbill", downSelect, filter.toArray(), "company");
|
||||
DataSet dataSet = upDataSet.union(downDataSet);
|
||||
dataSet = this.addExchangeRateAndCurrencyUnit(dataSet, paramMap);
|
||||
dataSet = dataSet.select(select);
|
||||
this.isCompute = false;
|
||||
GroupbyDataSet group = dataSet.groupBy(groupSelect);
|
||||
dataSet = group.sum("upamount").sum("downamount").finish();
|
||||
List<String> sumAmountFieldList = new ArrayList(2);
|
||||
sumAmountFieldList.add("upamount");
|
||||
sumAmountFieldList.add("downamount");
|
||||
sumAmountFieldList.add("differenceamount");
|
||||
this.setSumAmountFieldList(sumAmountFieldList);
|
||||
dataSet = dataSet.addField("upamount - downamount", "differenceamount");
|
||||
Object statCurrency = ((DynamicObject)paramMap.get("filter_statcurrency")).getPkValue();
|
||||
dataSet = dataSet.addField(String.valueOf(statCurrency), "currency");
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
public List<String> groupFields() {
|
||||
List<String> groupFieldList = new ArrayList(2);
|
||||
groupFieldList.add("parentorg");
|
||||
groupFieldList.add("parentorgid");
|
||||
return groupFieldList;
|
||||
}
|
||||
|
||||
public List<String> sumAmountFields() {
|
||||
if (this.sumAmountFieldList == null) {
|
||||
List<String> sumAmountFieldList = new ArrayList(2);
|
||||
sumAmountFieldList.add("upamount");
|
||||
sumAmountFieldList.add("downamount");
|
||||
this.sumAmountFieldList = sumAmountFieldList;
|
||||
}
|
||||
|
||||
return this.sumAmountFieldList;
|
||||
}
|
||||
|
||||
public void setSumAmountFieldList(List<String> sumAmountFieldList) {
|
||||
this.sumAmountFieldList = sumAmountFieldList;
|
||||
}
|
||||
|
||||
public String sumNameField() {
|
||||
return this.sumNameField;
|
||||
}
|
||||
|
||||
public void setSumNameField(String sumNameField) {
|
||||
this.sumNameField = sumNameField;
|
||||
}
|
||||
|
||||
public List<String> orinalAmountField() {
|
||||
return this.sumAmountFields();
|
||||
}
|
||||
|
||||
private QFilter initFilter(Map<String, Object> paramMap) {
|
||||
QFilter filter = new QFilter("entrys.state", "=", FcaTransDetailStatusEnum.NORMAL.getValue());
|
||||
filter.and(new QFilter("entrys.paystatus", "=", FcaTransPayStatusEnum.PAYSUCCESS.getValue()));
|
||||
DynamicObjectCollection currencies;
|
||||
List currencyIdList;
|
||||
if (paramMap.get("filter_bank") != null) {
|
||||
currencies = (DynamicObjectCollection)paramMap.get("filter_bank");
|
||||
currencyIdList = (List)currencies.stream().map(DataEntityBase::getPkValue).collect(Collectors.toList());
|
||||
filter.and("bank", "in", currencyIdList);
|
||||
}
|
||||
|
||||
if (paramMap.get("filter_org") != null) {
|
||||
filter.and("company", "in", paramMap.get("filter_org"));
|
||||
}
|
||||
|
||||
if (paramMap.get("filter_sonorg") != null) {
|
||||
filter.and("entrys.e_useorg", "in", paramMap.get("filter_sonorg"));
|
||||
}
|
||||
|
||||
if (paramMap.get("filter_accountgroup") != null) {
|
||||
filter.and("acctgrpid", "in", paramMap.get("filter_accountgroup"));
|
||||
}
|
||||
|
||||
if (paramMap.get("filter_currency") != null) {
|
||||
currencies = (DynamicObjectCollection)paramMap.get("filter_currency");
|
||||
currencyIdList = (List)currencies.stream().map(DataEntityBase::getPkValue).collect(Collectors.toList());
|
||||
filter.and("currency", "in", currencyIdList);
|
||||
}
|
||||
|
||||
String filterPeriod = (String)paramMap.get("filter_period");
|
||||
Date currDate = DateUtils.getCurrentDate();
|
||||
Date endDate;
|
||||
Date startDate;
|
||||
if (StringUtils.equals(StatisCycleEnum.THISMONTH.getCode(), filterPeriod)) {
|
||||
startDate = DateUtils.getFirstDayOfCurMonth();
|
||||
endDate = DateUtils.getFirstDayOfMonth(DateUtils.getNextMonth(currDate, 1));
|
||||
} else if (StringUtils.equals(StatisCycleEnum.LASTYEAR.getCode(), filterPeriod)) {
|
||||
startDate = DateUtils.getFirstYearDate(DateUtils.getLastYear(currDate, 1));
|
||||
endDate = DateUtils.getFirstDayOfCurYear();
|
||||
} else if (StringUtils.equals(StatisCycleEnum.THISYEAR.getCode(), filterPeriod)) {
|
||||
startDate = DateUtils.getFirstDayOfCurYear();
|
||||
endDate = DateUtils.getFirstYearDate(DateUtils.getNextYear(currDate, 1));
|
||||
} else if (StringUtils.equals(StatisCycleEnum.LASTMONTH.getCode(), filterPeriod)) {
|
||||
startDate = DateUtils.getFirstDayOfMonth(DateUtils.getLastMonth(currDate, 1));
|
||||
endDate = DateUtils.getFirstDayOfCurMonth();
|
||||
} else if (StringUtils.equals(StatisCycleEnum.TODAY.getCode(), filterPeriod)) {
|
||||
startDate = currDate;
|
||||
endDate = DateUtils.getNextDay(currDate, 1);
|
||||
} else if (StringUtils.equals(StatisCycleEnum.CONSTOM.getCode(), filterPeriod)) {
|
||||
startDate = (Date)paramMap.get("filter_startdate");
|
||||
endDate = (Date)paramMap.get("filter_enddate");
|
||||
endDate = DateUtils.getNextDay(endDate, 1);
|
||||
} else {
|
||||
startDate = DateUtils.getFirstDayOfCurMonth();
|
||||
endDate = DateUtils.getFirstDayOfMonth(DateUtils.getNextMonth(currDate, 1));
|
||||
}
|
||||
|
||||
filter.and("entrys.paydate", ">=", startDate);
|
||||
filter.and("entrys.paydate", "<", endDate);
|
||||
if (paramMap.get("orgIdList") != null) {
|
||||
filter.and("company", "in", paramMap.get("orgIdList"));
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
protected boolean isNeedCurrencyUnit() {
|
||||
return this.isCompute;
|
||||
}
|
||||
|
||||
protected boolean isNeedDimCurrency() {
|
||||
return this.isCompute;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue