parent
5272280c58
commit
1e959684cf
@ -9,7 +9,6 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|||||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||||
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
|
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
@ -22,9 +21,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhouc
|
* @author zhouc
|
||||||
* @date 2024/3/30 20:12
|
* @date 2024/3/30 20:12
|
||||||
* @className DebCredNewSubmitOp
|
* @className DebCredNewSubmitOp
|
||||||
* @description 贷记单提交服务插件
|
* @description 贷记单提交服务插件
|
||||||
*/
|
*/
|
||||||
public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn {
|
public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn {
|
||||||
@Override
|
@Override
|
||||||
@ -39,43 +38,22 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn {
|
|||||||
e.addValidator(new DebCredNewAuditValidatorOp());
|
e.addValidator(new DebCredNewAuditValidatorOp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void endOperationTransaction(EndOperationTransactionArgs e) {
|
|
||||||
DynamicObject[] dataEnties = e.getDataEntities();
|
|
||||||
for (DynamicObject temp : dataEnties) {
|
|
||||||
//2024-10-08 zhouc 修改至提交前计算
|
|
||||||
// getlast(temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
||||||
super.beforeExecuteOperationTransaction(e);
|
super.beforeExecuteOperationTransaction(e);
|
||||||
for (ExtendedDataEntity dataEntity : e.getSelectedRows()) {
|
for (ExtendedDataEntity dataEntity : e.getSelectedRows()) {
|
||||||
DynamicObject dynamicObject = dataEntity.getDataEntity();
|
DynamicObject dynamicObject = dataEntity.getDataEntity();
|
||||||
DynamicObject billObj = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), dynamicObject.getDynamicObjectType().getName());
|
|
||||||
DynamicObject yemCurrency = billObj.getDynamicObject("yem_currency");
|
|
||||||
getlast(dynamicObject);
|
getlast(dynamicObject);
|
||||||
if (yemCurrency != null) {
|
|
||||||
/*
|
|
||||||
(1)如果结算币别=美元:
|
|
||||||
① 扣减后金额(美元)=上次美元金额(实际)+ 配件资金池增加金额-配件资金池扣减金额;
|
|
||||||
② 扣减后金额(人民币)= 上次人民币金额(实际);
|
|
||||||
(2)如果结算币别=人民币:
|
|
||||||
① 扣减后金额(美元)=上次美元金额(实际);
|
|
||||||
② 扣减后金额(人民币)= 上次人民币金额(实际)+ 配件资金池增加金额-配件资金池扣减金额;
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
SaveServiceHelper.update(dynamicObject);
|
SaveServiceHelper.update(dynamicObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算上次美元金额(实际) 上次人民币金额(实际)
|
* 计算上次美元金额(实际) 上次人民币金额(实际)
|
||||||
*
|
* @param temp 单据数据
|
||||||
* @param temp
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void getlast(DynamicObject temp) {
|
public void getlast(DynamicObject temp) {
|
||||||
temp = BusinessDataServiceHelper.loadSingle(temp.getPkValue(), temp.getDynamicObjectType().getName());
|
temp = BusinessDataServiceHelper.loadSingle(temp.getPkValue(), temp.getDynamicObjectType().getName());
|
||||||
DynamicObject yemCurrency = temp.getDynamicObject("yem_currency");
|
DynamicObject yemCurrency = temp.getDynamicObject("yem_currency");
|
||||||
@ -98,24 +76,24 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn {
|
|||||||
String selectfielddebcrednote = DynamicObjectUtil.getSelectfields("yem_debcrednote", false);
|
String selectfielddebcrednote = DynamicObjectUtil.getSelectfields("yem_debcrednote", false);
|
||||||
DynamicObjectCollection debcrednote = QueryServiceHelper.query("yem_debcrednote",
|
DynamicObjectCollection debcrednote = QueryServiceHelper.query("yem_debcrednote",
|
||||||
selectfielddebcrednote, new QFilter[]{qFilter1}, "billno desc");
|
selectfielddebcrednote, new QFilter[]{qFilter1}, "billno desc");
|
||||||
if (debcrednote.size() > 0) {
|
if (!debcrednote.isEmpty()) {
|
||||||
String billno = debcrednote.get(0).getString("billno");
|
String billno = debcrednote.get(0).getString("billno");
|
||||||
temp.set("yem_lastbillno", billno);
|
temp.set("yem_lastbillno", billno);
|
||||||
}
|
}
|
||||||
//组织
|
//组织
|
||||||
DynamicObject org = temp.getDynamicObject("org");
|
DynamicObject org = temp.getDynamicObject("org");
|
||||||
String products = "";
|
String products = "";
|
||||||
if (yem_bd_products != null) {
|
String yem_bd_productsumber = yem_bd_products.getString("number");
|
||||||
String number = yem_bd_products.getString("number");
|
if (yem_bd_productsumber.contains("ZZJ")) {
|
||||||
if (number.contains("ZZJ")) {
|
|
||||||
products = "ZZJ";
|
products = "ZZJ";
|
||||||
} else if (number.contains("CC")) {
|
} else if (yem_bd_productsumber.contains("CC")) {
|
||||||
products = "CC";
|
products = "CC";
|
||||||
} else if (number.contains("TLJ")) {
|
} else if (yem_bd_productsumber.contains("TLJ")) {
|
||||||
products = "TLJ";
|
products = "TLJ";
|
||||||
|
} else if (yem_bd_productsumber.contains("WJJ")) {
|
||||||
|
products = "WJJ";
|
||||||
}
|
}
|
||||||
}
|
if (org != null) {
|
||||||
if (org != null && yem_customer != null && yem_credittype != null && products != null) {
|
|
||||||
QFilter qFilter = new QFilter("billstatus", QCP.equals, "C");//
|
QFilter qFilter = new QFilter("billstatus", QCP.equals, "C");//
|
||||||
qFilter.and(new QFilter("org.id", QCP.equals, org.getLong("id")));
|
qFilter.and(new QFilter("org.id", QCP.equals, org.getLong("id")));
|
||||||
qFilter.and(new QFilter("yem_customer.id", QCP.equals, yem_customer.getLong("id")));
|
qFilter.and(new QFilter("yem_customer.id", QCP.equals, yem_customer.getLong("id")));
|
||||||
@ -127,24 +105,21 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn {
|
|||||||
DynamicObjectCollection data = QueryServiceHelper.query("yem_spcapitalpool", selectfields, new QFilter[]{qFilter}, "billno");
|
DynamicObjectCollection data = QueryServiceHelper.query("yem_spcapitalpool", selectfields, new QFilter[]{qFilter}, "billno");
|
||||||
Map<Long, BigDecimal> map = new HashMap<>();
|
Map<Long, BigDecimal> map = new HashMap<>();
|
||||||
Map<Long, BigDecimal> map1 = new HashMap<>();
|
Map<Long, BigDecimal> map1 = new HashMap<>();
|
||||||
if (data.size() > 0) {
|
if (!data.isEmpty()) {
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (DynamicObject dynamicObject : data) {
|
||||||
DynamicObject dynamicObject = data.get(i);
|
|
||||||
long yem_curr = dynamicObject.getLong("yem_spcapitalpool_a.yem_curr");
|
long yem_curr = dynamicObject.getLong("yem_spcapitalpool_a.yem_curr");
|
||||||
BigDecimal yem_noamo = dynamicObject.getBigDecimal("yem_spcapitalpool_a.yem_actremaamount");//实际剩余金额
|
BigDecimal yem_noamo = dynamicObject.getBigDecimal("yem_spcapitalpool_a.yem_actremaamount");//实际剩余金额
|
||||||
BigDecimal yem_estamount = dynamicObject.getBigDecimal("yem_spcapitalpool_a.yem_estamount");//预计剩余金额
|
BigDecimal yem_estamount = dynamicObject.getBigDecimal("yem_spcapitalpool_a.yem_estamount");//预计剩余金额
|
||||||
if (map.containsKey(yem_curr)) {
|
if (map.containsKey(yem_curr)) {
|
||||||
BigDecimal bigDecimal = map.get(yem_curr);
|
map.computeIfPresent(yem_curr, (k, bigDecimal) -> bigDecimal.add(yem_noamo));
|
||||||
map.put(yem_curr, bigDecimal.add(yem_noamo));
|
map1.computeIfPresent(yem_curr, (k, bigDecimal1) -> bigDecimal1.add(yem_estamount));
|
||||||
BigDecimal bigDecimal1 = map1.get(yem_curr);
|
|
||||||
map1.put(yem_curr, bigDecimal1.add(yem_estamount));
|
|
||||||
} else {
|
} else {
|
||||||
map.put(yem_curr, yem_noamo);
|
map.put(yem_curr, yem_noamo);
|
||||||
map1.put(yem_curr, yem_estamount);
|
map1.put(yem_curr, yem_estamount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map.size() > 0) {
|
if (!map.isEmpty()) {
|
||||||
for (Long mapkey : map.keySet()) {
|
for (Long mapkey : map.keySet()) {
|
||||||
BigDecimal bigDecimal = map.get(mapkey);
|
BigDecimal bigDecimal = map.get(mapkey);
|
||||||
DynamicObject yem_em_replace = BusinessDataServiceHelper.loadSingle(mapkey, "bd_currency");
|
DynamicObject yem_em_replace = BusinessDataServiceHelper.loadSingle(mapkey, "bd_currency");
|
||||||
@ -180,7 +155,7 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map1.size() > 0) {
|
if (!map1.isEmpty()) {
|
||||||
for (Long mapkey : map1.keySet()) {
|
for (Long mapkey : map1.keySet()) {
|
||||||
BigDecimal bigDecimal = map1.get(mapkey);
|
BigDecimal bigDecimal = map1.get(mapkey);
|
||||||
DynamicObject yem_em_replace = BusinessDataServiceHelper.loadSingle(mapkey, "bd_currency");
|
DynamicObject yem_em_replace = BusinessDataServiceHelper.loadSingle(mapkey, "bd_currency");
|
||||||
@ -198,6 +173,7 @@ public class DebCredNewSubmitOp extends AbstractOperationServicePlugIn {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// throw new RuntimeException("返回");
|
||||||
SaveServiceHelper.update(temp);
|
SaveServiceHelper.update(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user