From ab53b52282c4ee0e57ae0fdb398de23b0949651a Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 25 十月 2024 19:11:37 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 29 +++++++++++++++++++++++++---- 1 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index e9caa9b..c41c544 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -608,12 +608,16 @@ if(times > m){ //充电时间跨度两个计费策略,需要继续对下一个策略进行计算 serviceCharge = s_server_amount.multiply(new BigDecimal(m)); - discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); rechargeAmount1 = rechargeAmount1.subtract(s_total_amount.multiply(new BigDecimal(m))); + if(null != discount){ + discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); + } nowTimeMillis = null; }else{ serviceCharge = s_server_amount.multiply(new BigDecimal(times)); - discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); + if(null != discount){ + discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); + } break; } } @@ -2043,7 +2047,7 @@ } @Override - public Long getAver(List<Integer> siteIds) { + public Double getAver(List<Integer> siteIds) { return this.baseMapper.getAver(siteIds); } @@ -2061,6 +2065,11 @@ public R payRefund(PayOrderRefundDto payOrderQueryDto) { if (payOrderQueryDto.getType()==1){ TChargingOrder tChargingOrder = this.baseMapper.selectById(payOrderQueryDto.getOrderId()); + if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ + return R.fail("退款金额需小于支付金额"); + } + + TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); chargingOrderRefund.setChargingOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); @@ -2122,6 +2131,9 @@ } if (payOrderQueryDto.getType()==2){ TShoppingOrder tChargingOrder = shoppingOrderService.getById(payOrderQueryDto.getOrderId()); + if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ + return R.fail("退款金额需小于支付金额"); + } TShoppingOrderRefund chargingOrderRefund = new TShoppingOrderRefund(); chargingOrderRefund.setShoppingOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); @@ -2171,6 +2183,10 @@ tChargingOrder.setRefundStatus(2); tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); + + if (payOrderQueryDto.getRefundAmount().compareTo(tChargingOrder.getPaymentAmount())==0){ + tChargingOrder.setStatus(5); + } shoppingOrderService.updateById(tChargingOrder); shoppingOrderRefundService.save(chargingOrderRefund); @@ -2544,7 +2560,7 @@ tSettlementConfirm.setIncomePercentage(0+"%"); tSettlementConfirm.setIncomePercentage(0+"%"); }else{ - BigDecimal subtract = income.subtract(beforeIncome).divide(beforeIncome).setScale(2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); + BigDecimal subtract = income.subtract(beforeIncome).divide(beforeIncome,2,RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); tSettlementConfirm.setIncomePercentage(subtract+"%"); tSettlementConfirm.setIncomePercentage(subtract+"%"); @@ -2664,4 +2680,9 @@ info.setDuration(0 == hour ? String.format("%s分钟", second) : String.format("%s小时%s分钟", hour, second)); return info; } + + @Override + public Long countNoTag() { + return this.baseMapper.countNoTag(); + } } -- Gitblit v1.7.1