余额表取数
This commit is contained in:
parent
d9659d4311
commit
ba93f9fb5e
|
@ -0,0 +1,92 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.list.plugin.AbstractListPlugin;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
|
||||
import kd.fi.gl.servicehelper.BalanceQueryParam;
|
||||
import kd.fi.gl.servicehelper.BanlanceServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 核算维度余额取数表(矿山二开)
|
||||
*/
|
||||
public class AssistbalancePlugin extends AbstractListPlugin implements Plugin {
|
||||
|
||||
|
||||
public static String ksNumberTop = "10006431"; //矿山总部组织编码
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
super.itemClick(evt);
|
||||
String itemKey = evt.getItemKey();
|
||||
if("zcgj_gatdata".equals(itemKey)) {
|
||||
BalanceQueryParam balanceQueryParam = new BalanceQueryParam();
|
||||
String[] selectorsArray = new String[]{"beginlocal", "endlocal", "yeardebitfor","yearcreditfor","debitlocal","creditlocal"};
|
||||
Arrays.asList(selectorsArray).forEach(balanceQueryParam::addSelector);
|
||||
|
||||
QFilter filterOrgId = new QFilter("number", QCP.equals,"100002");//主账簿
|
||||
DynamicObject accountbookstype = BusinessDataServiceHelper.loadSingle("bd_accountbookstype", "id,number", new QFilter[]{filterOrgId});
|
||||
balanceQueryParam.setBookTypeId(accountbookstype.getLong("id"));
|
||||
|
||||
QFilter filterperiod = new QFilter("number", QCP.equals,"202501");//期间
|
||||
DynamicObject period = BusinessDataServiceHelper.loadSingle("bd_period", "id,number", new QFilter[]{filterperiod});
|
||||
balanceQueryParam.setPeriodId(period.getLong("id"));
|
||||
|
||||
QFilter filtercurrency= new QFilter("number", QCP.equals,"CNY");//币别
|
||||
DynamicObject currency = BusinessDataServiceHelper.loadSingle("bd_currency", "id,number", new QFilter[]{filtercurrency});
|
||||
balanceQueryParam.setCurrencyId(currency.getLong("id"));
|
||||
|
||||
QFilter filteraccount= new QFilter("number", QCP.equals,"112204");//会计科目
|
||||
DynamicObject account = BusinessDataServiceHelper.loadSingle("bd_accountview", "id,number", new QFilter[]{filteraccount});
|
||||
|
||||
List<Map<String, Long>> paramMap = new ArrayList<>();
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("0001",0L);
|
||||
paramMap.add(map);
|
||||
balanceQueryParam.setAccountAssgrp(account.getLong("id"),paramMap);
|
||||
balanceQueryParam.addGroupBy("0001");
|
||||
balanceQueryParam.addGroupBy("account");
|
||||
for (Long orgId : getKsOrg()) {
|
||||
balanceQueryParam.setOrgId(orgId);
|
||||
List<Map<String, Object>> balance = BanlanceServiceHelper.getBalance(balanceQueryParam);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
//balanceQueryParam.setAccountAssgrp();
|
||||
|
||||
|
||||
/*
|
||||
private long orgId;
|
||||
private long bookTypeId; ..
|
||||
private long periodId;
|
||||
private long currencyId;
|
||||
private Map<Long, List<Map<String, Long>>> accountAssgrp = new HashMap();
|
||||
private List<String> groupBys = new ArrayList();
|
||||
private boolean isSubstractPL = false;*/
|
||||
//BanlanceServiceHelper.getBalance(balanceQueryParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Set<Long> getKsOrg(){
|
||||
QFilter filterOrgId = new QFilter("number", QCP.equals,ksNumberTop);//中材矿山建设有限公司
|
||||
DynamicObject adminOrg = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
|
||||
long orgId = adminOrg.getLong("id");
|
||||
List<Long> orgIds = new ArrayList<>(1);
|
||||
//orgIds.add(1692204547985902592L);
|
||||
orgIds.add(orgId);
|
||||
List<Long> subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true);
|
||||
return subOrgIds.stream().collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue