赞
踩
//调用BigDecimal
import java.text.DecimalFormat;
import java.math.BigDecimal;
//查询交易前账户余额
String Preamount = vars.get("acctBal1");
log.info("交易前账户余额------"+Preamount);
//查询交易前账户余额
String Postamount = vars.get("acctBal2");
log.info("交易后账户余额-----"+Postamount);
//用交易后余额减交易前余额乘0.01换算小数位,并计算出差额
String difference = String.valueOf(Double.parseDouble(Postamount)*Double.parseDouble("0.01")-Double.parseDouble(Preamount)*Double.parseDouble("0.01"));
log.info("差额-----"+difference);
//判断差额等于20
if (difference.equals("20.0")){
log.info(difference);
return;
}else{
log.info(difference);
Failure = true;
FailureMessage = "差额计算不正确";}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。