现金流量取数

This commit is contained in:
zhangzhiguo 2025-11-21 09:33:38 +08:00
parent bcafba7657
commit 1cf43ca37d
1 changed files with 71 additions and 6 deletions

View File

@ -43,7 +43,8 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
if(bsp.getStatus()== OperationStatus.ADDNEW ){
fundplyentry();
getCashflow();
getCashflowLY();
getCashflowLC();
}
}
@ -90,9 +91,11 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
}
}
getCashflow();
getCashflowLY();
getCashflowLC();
}else if("zcgj_org".equals(name)){
getCashflow();
getCashflowLY();
getCashflowLC();
}
}
@ -525,9 +528,9 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
}
/**
* 取现金流量项目
* 取现金流量项目-流入
*/
public void getCashflow(){
public void getCashflowLY(){
DynamicObject period = (DynamicObject)this.getModel().getValue("zcgj_period");
DynamicObject org = (DynamicObject)this.getModel().getValue("zcgj_org");
@ -544,7 +547,7 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
"\"bookTypeNumber\":\"100002\"," +
"\"periodNumber\":\""+periodnumber+"\"," +
"\"cfitemNumbers\":[" +
"\"01020402\"" + //往来款
"\"01010301\"" + //流入-往来款 01010301 01020402
"]," +
"\"groupBys\":[" +
"\"org\"" +
@ -584,6 +587,68 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
}
}
/**
* 取现金流量项目-流出
*/
public void getCashflowLC(){
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\"" + //流入-往来款 01010301
"]," +
"\"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(5);
dynamicObject.set("zcgj_cashamt",totalyearamount);//本年累计拨款-现金
this.getView().updateView("zcgj_fundplyentry");
}else{
DynamicObjectCollection fundplyentry = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_fundplyentry");
DynamicObject dynamicObject = fundplyentry.get(5);
dynamicObject.set("zcgj_cashamt",BigDecimal.ZERO);//本年累计拨款-现金
this.getView().updateView("zcgj_fundplyentry");
}
}
}
//公司资金往来