bihs 1 vecka sedan
förälder
incheckning
fa46dccfc0

+ 2 - 2
qmjszx-admin/src/main/java/beilv/web/controller/carinformation/CardAppController.java

@@ -521,9 +521,9 @@ public class CardAppController extends BaseController {
 
         result.put("historyList", maps);
         if ("1".equals(amountLog.getAmountType())) {
-            result.put("balance", vipCardService.selectVipCardByUserId(amountLog.getUserId()).getBalance());
+            result.put("balance", ObjectUtils.isEmpty(vipCardService.selectVipCardByUserId(amountLog.getUserId())) ? 0 : vipCardService.selectVipCardByUserId(amountLog.getUserId()).getBalance());
         } else if ("2".equals(amountLog.getAmountType())) {
-            result.put("score", vipCardService.selectVipCardByUserId(amountLog.getUserId()).getScore());
+            result.put("score", ObjectUtils.isEmpty(vipCardService.selectVipCardByUserId(amountLog.getUserId())) ? 0 : vipCardService.selectVipCardByUserId(amountLog.getUserId()).getScore());
         }
         return AjaxResult.success(result);
     }

+ 2 - 2
qmjszx-business/src/main/java/beilv/vipCardLog/service/impl/VipCardLogServiceImpl.java

@@ -345,8 +345,8 @@ public class VipCardLogServiceImpl implements IVipCardLogService {
             //计算已使用次数
             BigDecimal useSum = BigDecimal.valueOf(carInformation.getTotalNumber() - userMembershipCard.getRemainingNumber());
 
-            //计算需要支付的金额 = 原价 / 总次数(四舍五入) * 已使用次数
-            BigDecimal userPrice = carInformation.getOriginalPrice().divide(BigDecimal.valueOf(carInformation.getTotalNumber()), 2, RoundingMode.HALF_UP).multiply(useSum);
+            //计算需要支付的金额 = 原价 / 总次数(直接截断,不进行四舍五入) * 已使用次数
+            BigDecimal userPrice = carInformation.getOriginalPrice().divide(BigDecimal.valueOf(carInformation.getTotalNumber()), 2, RoundingMode.DOWN).multiply(useSum);
 
             //实际支付的金额 - 需要支付的金额 = 退款金额
             BigDecimal refundMoner = orderInfo.getPracticalMoney().subtract(userPrice);