修复除法未指定精度问题

This commit is contained in:
yuxueliang0813 2024-12-26 10:44:21 +08:00
parent a5089a619b
commit 28017f49e7
1 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import nccloud.open.api.auto.token.cur.utils.APICurUtils;
import okhttp3.*;
import shkd.utils.DobeDWUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
@ -143,6 +144,7 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
if(contextUrl != null && contextUrl.startsWith("http://isctest")){
return;
}
DynamicObject[] dos = e.getDataEntities();
DynamicObject prinfo = null;
boolean isBipSuccess = false;
@ -331,9 +333,12 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
items.put("notax_de","-"+bcsqje.toString());
}
}else{
items.put("taxrate",invoicetax.divide(bcsqje.subtract(invoicetax)).multiply(BigDecimal.valueOf(100)));//税率=税额/不含税 * 100
//不含税金额
BigDecimal notaxv = bcsqje.subtract(invoicetax);
//除法时指定精度和舍入模式
items.put("taxrate",invoicetax.divide(notaxv,10,RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).toString());//税率=税额/不含税 * 100
items.put("local_tax_de",invoicetax.toString());//税额
items.put("notax_de",bcsqje.subtract(invoicetax).toString());//贷方无税金额除税金额
items.put("notax_de",notaxv.toString());//贷方无税金额除税金额
if("unaudit".equals(eventName)){
//如果此时是反审核则需要将金额置为负数
items.put("local_tax_de","-"+items.getString("local_tax_de"));