1.付款推送费控优化

2.强(弱)共享报表优化
--s
This commit is contained in:
weiyunlong 2025-04-07 15:45:01 +08:00
parent 007cac798e
commit 711e5c584e
2 changed files with 48 additions and 25 deletions

View File

@ -32,6 +32,7 @@ public class PaybillOperation extends AbstractOperationServicePlugIn implements
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
Boolean isSuccess = true;//FKZJ2025040007
String operationKey = e.getOperationKey();
if ("pushfk".equals(operationKey)) {
DynamicObject[] dataEntities = e.getDataEntities();
@ -42,37 +43,44 @@ public class PaybillOperation extends AbstractOperationServicePlugIn implements
if (null != paymentidentify) {
if (!"FKBS02".equals(paymentidentify.getString("number"))) {
addErrorInfo(bill, "付款标识不为被动付款");
isSuccess = false;
}
} else {
addErrorInfo(bill, "付款标识为空无法判断被动主动");
isSuccess = false;
}
DynamicObject shjhBizsmall = bill.getDynamicObject("shjh_bizsmall");
if (null != shjhBizsmall) {
if (!shjhBizsmall.getBoolean("shjh_tsfk")) {
addErrorInfo(bill, "【业务小类】中【是否推送费控系统】=否");
isSuccess = false;
}
} else {
addErrorInfo(bill, "业务小类为空");
isSuccess = false;
}
if (bill.getBoolean("shjh_ispushfk")) {
addErrorInfo(bill, "付款单需推送费控系统 = 是");
isSuccess = false;
}
}
JSONObject data = new JSONObject();
// 构建header
JSONObject header = buildHeader(bill);
// 构建body
JSONArray body = buildBody(bill);
data.put("header", header);
data.put("body", body);
JSONObject jsonObject = withholding_billing(data, bill.getString("billno"));
String code = (String) jsonObject.get("code");
if (!"0".equals(code)) {
addErrorInfo(bill, "推送费控失败:" + jsonObject.get("msg"));
} else {
bill.set("shjh_ispushfk", true);
SaveServiceHelper.save(new DynamicObject[]{bill});
this.operationResult.addSuccessPkId(bill.getPkValue());
if (isSuccess) {
JSONObject data = new JSONObject();
// 构建header
JSONObject header = buildHeader(bill);
// 构建body
JSONArray body = buildBody(bill);
data.put("header", header);
data.put("body", body);
JSONObject jsonObject = withholding_billing(data, bill.getString("billno"));
String code = (String) jsonObject.get("code");
if (!"0".equals(code)) {
addErrorInfo(bill, ""+jsonObject.get("msg"));
} else {
bill.set("shjh_ispushfk", true);
SaveServiceHelper.save(new DynamicObject[]{bill});
this.operationResult.addSuccessPkId(bill.getPkValue());
}
}
}
}

View File

@ -18,7 +18,7 @@ import kd.sdk.plugin.Plugin;
import java.util.Date;
/**
* 共享报表
* ()共享报表
* shjh_strongsharing
*/
public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin implements Plugin {
@ -35,12 +35,19 @@ public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin imple
FilterInfo filter = reportQueryParam.getFilter();
Date shjh_jzdate = filter.getDate("shjh_jzdate");//基准日期
QFilter q1 = new QFilter("bizdate", QCP.equals, shjh_jzdate);//交易日期
String shjhIsshare = filter.getString("shjh_isshare");//公司属性
if (shjhIsshare.equals("1")) {
q1.and(new QFilter("company.shjh_isshare", QCP.equals, "1"));//公司属性为强共享
}else {
q1.and(new QFilter("company.shjh_isshare", QCP.equals, "0"));//公司属性为弱共享
}
DataSet result1 = null;
// 被动付款入账
DataSet beiIntelpay1 = QueryServiceHelper.queryDataSet(this.getClass().getName(), BEI_INTELPAY,
"id,billno as shjh_billno,company.number as shjh_orgnumber,company.name as shjh_orgname," +
"bank.number as banknumber,biztime as shjh_biztime,transbalance as shjh_amountjz,accountbank.id as accountbankid",
"bank.number as banknumber,biztime as shjh_biztime,transbalance as shjh_amountjz,accountbank.id as accountbankid," +
"company.shjh_isshare as shjh_companyisshare",
q1.toArray(), null);
// 合作金融机构 bd_finorginfo
DataSet bdAccountbanks1 = QueryServiceHelper.queryDataSet(this.getClass().getName(),
@ -55,7 +62,7 @@ public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin imple
DataSet joinedDataSet = distinctBeiIntelpay.join(distinctBdAccountbanks)
.on("banknumber", "finorginfonumber")
.select(new String[]{"shjh_billno", "shjh_orgnumber", "shjh_orgname", "shjh_bankname", "banknumber",
"shjh_biztime", "shjh_amountjz", "accountbankid"})
"shjh_biztime", "shjh_amountjz", "accountbankid","shjh_companyisshare"})
.finish();
// 按银行账户id分组,取最大日期的集合
@ -68,11 +75,11 @@ public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin imple
.on("accountbankid", "accountbankid")
.on("shjh_biztime", "shjh_biztime")
.select(new String[]{"shjh_billno", "shjh_orgnumber", "shjh_orgname", "shjh_bankname", "banknumber",
"shjh_biztime", "shjh_amountjz","accountbankid"})
"shjh_biztime", "shjh_amountjz","accountbankid","shjh_companyisshare"})
.finish();
// 再次根据银行编码分组 求和余额
result1 = result.groupBy(new String[]{"shjh_orgnumber", "shjh_orgname", "shjh_bankname","banknumber"}).sum("shjh_amountjz").finish();
result1 = result.groupBy(new String[]{"shjh_orgnumber", "shjh_orgname", "shjh_bankname","banknumber","shjh_companyisshare"}).sum("shjh_amountjz").finish();
// // 分组后和源集合联表:除银行编码,余额的其他字段进行组合返回前台
// result1 = result.join(finish1)
@ -104,11 +111,18 @@ public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin imple
Date shjh_tnbjdate = filter.getDate("shjh_tnbjdate");//同年比较日期
QFilter q2 = new QFilter("bizdate", QCP.equals, shjh_tnbjdate);//交易日期
if (shjhIsshare.equals("1")) {
q2.and(new QFilter("company.shjh_isshare", QCP.equals, "1"));//公司属性为强共享
}else {
q2.and(new QFilter("company.shjh_isshare", QCP.equals, "0"));//公司属性为弱共享
}
DataSet result2 = null;
// 原始查询
DataSet beiIntelpay2 = QueryServiceHelper.queryDataSet(this.getClass().getName(), BEI_INTELPAY,
"id,billno as shjh_billno,company.number as shjh_orgnumber,company.name as shjh_orgname," +
"bank.number as banknumber,biztime as shjh_biztime,transbalance as shjh_amounttn,accountbank.id as accountbankid",
"bank.number as banknumber,biztime as shjh_biztime,transbalance as shjh_amounttn,accountbank.id as accountbankid," +
"company.shjh_isshare as shjh_companyisshare",
q2.toArray(), null);
// 合作金融机构 bd_finorginfo
DataSet bdAccountbanks2 = QueryServiceHelper.queryDataSet(this.getClass().getName(),
@ -123,7 +137,7 @@ public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin imple
DataSet joinedDataSet = distinctBeiIntelpay.join(distinctBdAccountbanks)
.on("banknumber", "finorginfonumber")
.select(new String[]{"shjh_billno", "shjh_orgnumber", "shjh_orgname", "shjh_bankname", "banknumber",
"shjh_biztime", "shjh_amounttn","accountbankid"})
"shjh_biztime", "shjh_amounttn","accountbankid","shjh_companyisshare"})
.finish();
// 按银行账户id分组,取最大日期的集合
@ -136,11 +150,11 @@ public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin imple
.on("accountbankid", "accountbankid")
.on("shjh_biztime", "shjh_biztime")
.select(new String[]{"shjh_billno", "shjh_orgnumber", "shjh_orgname", "shjh_bankname", "banknumber",
"shjh_biztime", "shjh_amounttn","accountbankid"})
"shjh_biztime", "shjh_amounttn","accountbankid","shjh_companyisshare"})
.finish();
// 再次根据银行编码分组 求和余额
result2 = result.groupBy(new String[]{"shjh_orgnumber", "shjh_orgname", "shjh_bankname","banknumber"}).sum("shjh_amounttn").finish();
result2 = result.groupBy(new String[]{"shjh_orgnumber", "shjh_orgname", "shjh_bankname","banknumber","shjh_companyisshare"}).sum("shjh_amounttn").finish();
// // 分组后和源集合联表:除银行编码,余额的其他字段进行组合返回前台
// result2 = result.join(finish1)
@ -177,7 +191,8 @@ public class StrongSharingQueryPlugin extends AbstractReportListDataPlugin imple
.on("shjh_orgname", "shjh_orgname")
.on("shjh_bankname", "shjh_bankname")
.on("shjh_orgnumber", "shjh_orgnumber")
.select(new String[]{"shjh_orgnumber", "shjh_orgname", "shjh_bankname", "banknumber",
.on("shjh_companyisshare", "shjh_companyisshare")
.select(new String[]{"shjh_orgnumber", "shjh_orgname", "shjh_bankname", "banknumber","shjh_companyisshare",
"shjh_amountjz", "shjh_amounttn"})
.finish();
finalResult.print(true);