|
@@ -20,6 +20,7 @@ import kd.bos.orm.query.QFilter;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
|
+import kd.imc.bdm.common.constant.BotpCallBackLogConstant;
|
|
import nckd.base.helper.CommonHelperUtils;
|
|
import nckd.base.helper.CommonHelperUtils;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
@@ -550,6 +551,10 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ qFilter = new QFilter("contractcode", QCP.equals, contract);
|
|
|
|
+ DynamicObject contractInfo = BusinessDataServiceHelper.loadSingle("er_contractbill", qFilter.toArray());
|
|
|
|
+
|
|
|
|
|
|
DynamicObject billTypeInfo = CommonHelperUtils.queryBaseDynamicObject("bos_billtype", "number", "er_prepaybill_BT_S");
|
|
DynamicObject billTypeInfo = CommonHelperUtils.queryBaseDynamicObject("bos_billtype", "number", "er_prepaybill_BT_S");
|
|
|
|
|
|
@@ -562,6 +567,7 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
returnMessage = e.getMessage();
|
|
returnMessage = e.getMessage();
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
|
|
dailyLoanBill.set("bizdate", bizDate);
|
|
dailyLoanBill.set("bizdate", bizDate);
|
|
dailyLoanBill.set("billstatus", "A");
|
|
dailyLoanBill.set("billstatus", "A");
|
|
@@ -584,6 +590,7 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
dailyLoanBill.set("detailtype", "biztype_other");
|
|
dailyLoanBill.set("detailtype", "biztype_other");
|
|
dailyLoanBill.set("ispush", "false");
|
|
dailyLoanBill.set("ispush", "false");
|
|
dailyLoanBill.set("nckd_srmstatus", "1");
|
|
dailyLoanBill.set("nckd_srmstatus", "1");
|
|
|
|
+
|
|
|
|
|
|
BigDecimal totalReimburseAmount = BigDecimal.ZERO;
|
|
BigDecimal totalReimburseAmount = BigDecimal.ZERO;
|
|
|
|
|
|
@@ -632,6 +639,12 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
dailyLoanBill.set("expenseentryentity", expenseEntry);
|
|
dailyLoanBill.set("expenseentryentity", expenseEntry);
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ qFilter = new QFilter("number", QCP.equals, "BANK");
|
|
|
|
+
|
|
|
|
+ DynamicObject settleType = BusinessDataServiceHelper.loadSingle("bd_settlementtype", qFilter.toArray());
|
|
|
|
+ DynamicObject supplier = null;
|
|
|
|
+
|
|
DynamicObjectCollection accountEntry = dailyLoanBill.getDynamicObjectCollection("accountentry");
|
|
DynamicObjectCollection accountEntry = dailyLoanBill.getDynamicObjectCollection("accountentry");
|
|
type = accountEntry.getDynamicObjectType();
|
|
type = accountEntry.getDynamicObjectType();
|
|
JSONArray dailyLoanBillAccountEntry = inputData.getJSONArray("dailyLoanBillAccountEntry");
|
|
JSONArray dailyLoanBillAccountEntry = inputData.getJSONArray("dailyLoanBillAccountEntry");
|
|
@@ -653,11 +666,13 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
}
|
|
}
|
|
|
|
|
|
- DynamicObject supplier = CommonHelperUtils.queryBaseDynamicObject("bd_supplier", "societycreditcode", payerName);
|
|
+ supplier = CommonHelperUtils.queryBaseDynamicObject("bd_supplier", "societycreditcode", payerName);
|
|
if(supplier == null){
|
|
if(supplier == null){
|
|
returnMessage = "供应商(" + payerName + ")在星瀚系统中未匹配到数据!";
|
|
returnMessage = "供应商(" + payerName + ")在星瀚系统中未匹配到数据!";
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ DynamicObjectCollection entryBanks = supplier.getDynamicObjectCollection("entry_bank");
|
|
|
|
|
|
DynamicObject currency = CommonHelperUtils.queryBaseDynamicObject("bd_currency", "number", currencyType);
|
|
DynamicObject currency = CommonHelperUtils.queryBaseDynamicObject("bd_currency", "number", currencyType);
|
|
if(currency == null){
|
|
if(currency == null){
|
|
@@ -672,9 +687,24 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
BigDecimal amountOriLocal = amountOri.multiply(exchangeRate).setScale(4, BigDecimal.ROUND_HALF_UP);
|
|
BigDecimal amountOriLocal = amountOri.multiply(exchangeRate).setScale(4, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
DynamicObject entry = new DynamicObject(type);
|
|
DynamicObject entry = new DynamicObject(type);
|
|
|
|
+
|
|
|
|
+ entry.set("paymode", settleType);
|
|
entry.set("payertype", "bd_supplier");
|
|
entry.set("payertype", "bd_supplier");
|
|
entry.set("supplier", supplier);
|
|
entry.set("supplier", supplier);
|
|
entry.set("payername", supplier.getString("name"));
|
|
entry.set("payername", supplier.getString("name"));
|
|
|
|
+
|
|
|
|
+ if(entryBanks.size() > 0){
|
|
|
|
+ for(DynamicObject entryBank : entryBanks){
|
|
|
|
+ if(entryBank.getBoolean("isdefault_bank")){
|
|
|
|
+ entry.set("payeraccount", entryBank.getString("bankaccount"));
|
|
|
|
+ entry.set("payeraccountname", entryBank.getString("accountname"));
|
|
|
|
+ entry.set("payerbank", entryBank.getDynamicObject("bank"));
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
entry.set("accountcurrency", currency);
|
|
entry.set("accountcurrency", currency);
|
|
entry.set("accexchangerate", exchangeRate);
|
|
entry.set("accexchangerate", exchangeRate);
|
|
entry.set("orireceiveamount", amountOri);
|
|
entry.set("orireceiveamount", amountOri);
|
|
@@ -688,6 +718,83 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
}
|
|
}
|
|
dailyLoanBill.set("accountentry", accountEntry);
|
|
dailyLoanBill.set("accountentry", accountEntry);
|
|
|
|
|
|
|
|
+ if(supplier == null){
|
|
|
|
+ returnMessage = "无收款供应商信息!";
|
|
|
|
+ return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(contractInfo != null){
|
|
|
|
+ DynamicObjectCollection contractEntry = dailyLoanBill.getDynamicObjectCollection("contractentry");
|
|
|
|
+ type = contractEntry.getDynamicObjectType();
|
|
|
|
+
|
|
|
|
+ DynamicObject currency = contractInfo.getDynamicObject("contractcurrency");
|
|
|
|
+ currency = CommonHelperUtils.queryBaseDynamicObject("bd_currency", "number", currency.getString("number"));
|
|
|
|
+
|
|
|
|
+ if(currency == null){
|
|
|
|
+ returnMessage = "币别(" + orgUnit + ")在星瀚系统中未匹配到数据!";
|
|
|
|
+ return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal exchangeRate = BigDecimal.ONE;
|
|
|
|
+ if(currency.getLong("id") != 1L){
|
|
|
|
+ exchangeRate = CommonHelperUtils.getExchangeRate(exchangeTableId, currency.getLong("id"), 1L, bizDate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal contractAmount = contractInfo.getBigDecimal("contractamount");
|
|
|
|
+ BigDecimal oriapplyAmount = contractInfo.getBigDecimal("oriapplyamount");
|
|
|
|
+
|
|
|
|
+ DynamicObjectCollection contractPartyEntry = contractInfo.getDynamicObjectCollection("contractpartyentry");
|
|
|
|
+ if(contractPartyEntry.size() > 0){
|
|
|
|
+ for(DynamicObject partyEntry : contractPartyEntry){
|
|
|
|
+ DynamicObject entry = new DynamicObject(type);
|
|
|
|
+
|
|
|
|
+ DynamicObject contractparty = partyEntry.getDynamicObject("contractparty");
|
|
|
|
+ if(contractparty.getLong("id") != supplier.getLong("id")){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ entry.set("seq", 1);
|
|
|
|
+ entry.set("contractcode", contract);
|
|
|
|
+ entry.set("contractname", contractInfo.getString("contractname"));
|
|
|
|
+ entry.set("signdate", contractInfo.getDate("signdate"));
|
|
|
|
+ entry.set("contractdescription", contractInfo.getString("description"));
|
|
|
|
+ entry.set("contractapplier", contractInfo.getDynamicObject("applier"));
|
|
|
|
+ entry.set("contractcostorg", contractInfo.getDynamicObject("costcompany"));
|
|
|
|
+ entry.set("contractparta", contractInfo.getDynamicObject("parta"));
|
|
|
|
+ entry.set("contractpartbtype", "bd_supplier");
|
|
|
|
+ entry.set("contractpartb", contractparty);
|
|
|
|
+
|
|
|
|
+ DynamicObjectCollection payplanEntrys = contractInfo.getDynamicObjectCollection("expenseentryentity");
|
|
|
|
+ if(payplanEntrys.size() > 0){
|
|
|
|
+ DynamicObject planEntry = payplanEntrys.get(0);
|
|
|
|
+
|
|
|
|
+ entry.set("contractexppaytypeid", planEntry.getDynamicObject("paymenttypeid"));
|
|
|
|
+ entry.set("contractexphappendate", planEntry.getDate("happendate"));
|
|
|
|
+ entry.set("contractexpproject", planEntry.getDynamicObject("std_project"));
|
|
|
|
+ entry.set("contractexpenseitem", planEntry.getDynamicObject("expenseitem"));
|
|
|
|
+ entry.set("contractexpcurrency", planEntry.getDynamicObject("entrycurrency"));
|
|
|
|
+ entry.set("contractexpchangerate", planEntry.getBigDecimal("exchangerate"));
|
|
|
|
+ entry.set("contractexpquotetype", "0");
|
|
|
|
+ entry.set("contractnotpayamount", planEntry.getBigDecimal("expnotpayamount"));
|
|
|
|
+ entry.set("contractcanloanamount", planEntry.getBigDecimal("canloanamount"));
|
|
|
|
+ entry.set("concurrcanloanamount", planEntry.getBigDecimal("canloancurramount"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ entry.set("contractpartatypenew", "bos_org");
|
|
|
|
+ entry.set("contractpartanew", costCompany);
|
|
|
|
+ entry.set("nckd_contractamt", contractAmount);
|
|
|
|
+ entry.set("nckd_oriapplyamt", oriapplyAmount);
|
|
|
|
+
|
|
|
|
+ contractEntry.add(entry);
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dailyLoanBill.set("contractentry", contractEntry);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
dailyLoanBill.set("loanamount", totalReimburseAmount);
|
|
dailyLoanBill.set("loanamount", totalReimburseAmount);
|
|
dailyLoanBill.set("approveamount", totalReimburseAmount);
|
|
dailyLoanBill.set("approveamount", totalReimburseAmount);
|