ctOrders.setCanUseTotal(ArithBigUtil.sub(ctOrders.getCanUseTotal(), coinNum));
log.info("setCanUseTotal:"+ArithBigUtil.sub(ctOrders.getCanUseTotal(), coinNum));
ctOrders.setCanuseTotalver(bchange.core.encrypt.EbChangeEncode.encryptKeyMD5
(Utils.bigDecimalFormat(ArithBigUtil.sub(ctOrders.getCanUseTotal(), coinNum))));
以上写法是错误的。 ctOrders.setCanUseTotal 被set后,下面 GET后,值就变成新值了。又做了一次减法。
正确的写法
BigDecimal iCanUseTotal=ArithBigUtil.sub(ctOrders.getCanUseTotal(), coinNum);
ctOrders.setCanUseTotal(iCanUseTotal);
log.info("setCanUseTotal:"+iCanUseTotal);
ctOrders.setCanuseTotalver(bchange.core.encrypt.EbChangeEncode.encryptKeyMD5
(Utils.bigDecimalFormat(iCanUseTotal)));
网友评论