资金计划申请现金流量取数

This commit is contained in:
zhangzhiguo 2025-11-18 15:18:15 +08:00
parent d049384f2b
commit af912e0444
2 changed files with 105 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import kd.bos.util.StringUtils;
import kd.fi.bcm.business.model.BalanceQueryParamApi;
import kd.sdk.plugin.Plugin;
import zcgj.zcdev.zcdev.pr.plugin.utils.AccountRecord;
import zcgj.zcdev.zcdev.pr.plugin.utils.CashflowRecord;
import java.lang.reflect.Type;
import java.math.BigDecimal;
@ -42,6 +43,7 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
if(bsp.getStatus()== OperationStatus.ADDNEW ){
fundplyentry();
getCashflow();
}
}
@ -88,6 +90,9 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
}
}
getCashflow();
}else if("zcgj_org".equals(name)){
getCashflow();
}
}
@ -519,6 +524,68 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
return BigDecimal.ZERO;
}
/**
* 取现金流量项目
*/
public void getCashflow(){
DynamicObject period = (DynamicObject)this.getModel().getValue("zcgj_period");
DynamicObject org = (DynamicObject)this.getModel().getValue("zcgj_org");
if(period != null && org != null){
String periodnumber = period.getString("number");
String orgnumber = org.getString("number");
String par = "{" +
"\"selectors\":[" +
"\"org\"," +
"\"yearamount\"," +
"\"amount\"" +
"]," +
"\"orgNumber\":\""+orgnumber+"\"," +
"\"bookTypeNumber\":\"100002\"," +
"\"periodNumber\":\""+periodnumber+"\"," +
"\"cfitemNumbers\":[" +
"\"01020402\"" + //往来款
"]," +
"\"groupBys\":[" +
"\"org\"" +
"]" +
"}";
log.info("FundingplanapplyAccountBalancePlugin:获取现金流量项目-par"+par);
Gson gson = new Gson();
Map<String, Object> params1 = gson.fromJson(par,
new TypeToken<Map<String, Object>>() {
}.getType());
OpenApiResult balanceData = OpenApiSdkUtil.invoke("/v2/gl/getCashflowApi", params1);
log.info("FundingplanapplyAccountBalancePlugin:获取现金流量项目-"+balanceData.getMessage());
if (balanceData.isStatus()) {
String data = (String) balanceData.getData();
Type listType = new TypeToken<List<CashflowRecord>>() {
}.getType();
List<CashflowRecord> records = gson.fromJson(data, listType);
BigDecimal totalyearamount = BigDecimal.ZERO;//本年累计
BigDecimal totalamount = BigDecimal.ZERO;//本期发生
for (CashflowRecord record : records) {
totalyearamount = totalyearamount.add(record.getYearamount());//期初本位币金额
totalamount = totalamount.add(record.getAmount());//期末本位币金额
}
DynamicObjectCollection fundplyentry = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_fundplyentry");
DynamicObject dynamicObject = fundplyentry.get(6);
dynamicObject.set("zcgj_cashamt",totalyearamount);//本年累计拨款-现金
this.getView().updateView("zcgj_fundplyentry");
}else{
DynamicObjectCollection fundplyentry = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_fundplyentry");
DynamicObject dynamicObject = fundplyentry.get(6);
dynamicObject.set("zcgj_cashamt",BigDecimal.ZERO);//本年累计拨款-现金
this.getView().updateView("zcgj_fundplyentry");
}
}
}
//公司资金往来
public void fundplyentry(){
fundplyentryXJ();//现金
@ -704,4 +771,6 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
}
}
}
}

View File

@ -0,0 +1,36 @@
package zcgj.zcdev.zcdev.pr.plugin.utils;
import java.math.BigDecimal;
/**
* 现金流量
*/
public class CashflowRecord {
private long org;//核算组织
private BigDecimal yearamount;//本年累计
private BigDecimal amount;//本期发生
public long getOrg() {
return org;
}
public void setOrg(long org) {
this.org = org;
}
public BigDecimal getYearamount() {
return yearamount;
}
public void setYearamount(BigDecimal yearamount) {
this.yearamount = yearamount;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
}