From 596bb58b52026625fbbad8e4232e9c817636264e Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 01 十一月 2024 17:57:39 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 65 +++++++++++++++++++------------- 1 files changed, 39 insertions(+), 26 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 b69b73f..8e9c47b 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 @@ -1103,7 +1103,7 @@ String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); appUserIntegralChange.setCode(code); appUserIntegralChange.setAppUserId(appUser1.getId()); - appUserIntegralChange.setChangeType(5); + appUserIntegralChange.setChangeType(4); appUserIntegralChange.setHistoricalIntegral(appUser1.getPoints()); appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); appUserIntegralChange.setCreateTime(LocalDateTime.now()); @@ -1206,8 +1206,8 @@ BigDecimal electronicMoney = new BigDecimal("0"); BigDecimal serviceMoney = new BigDecimal("0"); for (ChargingOrderVO chargingOrderVO : list) { - chargingOrderVO.setCommissionAmount(chargingOrderVO.getServiceCharge().multiply(new BigDecimal("0.006"))); - chargingOrderVO.setPlatFormMoney(chargingOrderVO.getServiceCharge().multiply(new BigDecimal("0.006"))); + chargingOrderVO.setCommissionAmount(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); + chargingOrderVO.setPlatFormMoney(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); chargingOrderVO.setUid(chargingOrderVO.getId()+""); TChargingGun data3 = chargingGunClient.getChargingGunById(chargingOrderVO.getChargingGunId()).getData(); TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderVO.getChargingPileId()).getData(); @@ -1399,12 +1399,11 @@ List<ChargingOrderListVO> list = this.baseMapper.chargingList(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); for (ChargingOrderListVO chargingOrderListVO : list) { chargingOrderListVO.setChargingCapacity(chargingOrderListVO.getElectricity()); - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); BigDecimal bigDecimal = new BigDecimal("0.006"); if (chargingOrderListVO.getOrderAmount()!=null){ chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getOrderAmount().multiply(bigDecimal)); } - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getResidualAmount()==null?chargingOrderListVO.getPaymentAmount():chargingOrderListVO.getPaymentAmount()); + chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); chargingOrderListVO.setUid(chargingOrderListVO.getId()+""); List<Integer> integers = new ArrayList<>(); integers.add(chargingOrderListVO.getSiteId()); @@ -1423,7 +1422,7 @@ UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderListVO.getCode()).getData(); if (data5!=null){ if (data5.getTime_remaining()!=null){ - chargingOrderListVO.setChargingSecond(data5.getTime_remaining()*60L); + chargingOrderListVO.setChargingSecond(data5.getCumulative_charging_time()*60L); } } @@ -1432,8 +1431,8 @@ List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData(); if (data6!=null && !data6.isEmpty()){ // 第一条数据soc为开始 最后一条数据soc为结束soc - chargingOrderListVO.setStartSoc(data6.get(0).getSoc().toString()); - chargingOrderListVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListVO.setEndSoc(data6.get(0).getSoc().toString()); + chargingOrderListVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); } } @@ -1613,9 +1612,7 @@ @Override public ChargingOrderListInfoVO chargingInfo(String uid) { TChargingOrder chargingOrder= this.getById(uid); - ChargingOrderListInfoVO chargingOrderListInfoVO = new ChargingOrderListInfoVO(); - chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); BigDecimal bigDecimal = new BigDecimal("0.006"); if (chargingOrder.getOrderAmount()!=null){ @@ -1664,24 +1661,32 @@ if (uploadRealTimeMonitoringData.getOutput_current()!=null&& uploadRealTimeMonitoringData.getOutput_voltage()!=null){ uploadRealTimeMonitoringData.setPower(uploadRealTimeMonitoringData.getOutput_voltage() - .multiply(uploadRealTimeMonitoringData.getOutput_current())); + .multiply(uploadRealTimeMonitoringData.getOutput_current()).divide(new BigDecimal(1000),2, BigDecimal.ROUND_HALF_UP)); } } if (!data6.isEmpty()){ // 第一条数据soc为开始 最后一条数据soc为结束soc - chargingOrderListInfoVO.setStartSoc(data6.get(0).getSoc().toString()); - chargingOrderListInfoVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListInfoVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListInfoVO.setEndSoc(data6.get(0).getSoc().toString()); chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree()); - chargingOrderListInfoVO.setChargingSecond(data6.get(data6.size()-1).getCumulative_charging_time()*60+""); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { uploadRealTimeMonitoringData.setCreateTime(simpleDateFormat.format(uploadRealTimeMonitoringData.getCreate_time())); } } } + chargingOrderListInfoVO.setList(data6); } + // 获取充电时间 + UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); + if (data5!=null){ + if (data5.getTime_remaining()!=null){ + chargingOrderListInfoVO.setChargingSecond(data5.getCumulative_charging_time()*60L+""); + } + } if (chargingOrder.getAppUserCarId()!=null){ List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(chargingOrder.getAppUserCarId())).getData(); @@ -2029,7 +2034,7 @@ } } - order.setServiceCharge(periodServicePrice_total); + order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.DOWN)); order.setPaymentAmount(payAmount); order.setRefundAmount(refundAmount); order.setRefundStatus(1); @@ -2242,6 +2247,9 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } + if ((tChargingOrder.getRechargeAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ + tChargingOrder.setStatus(5); + } TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); @@ -2308,6 +2316,10 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } + if ((tChargingOrder.getPaymentAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ + tChargingOrder.setStatus(5); + } + TShoppingOrderRefund chargingOrderRefund = new TShoppingOrderRefund(); chargingOrderRefund.setShoppingOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); @@ -2358,9 +2370,7 @@ 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); @@ -2375,6 +2385,8 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } + + TVipOrderRefund chargingOrderRefund = new TVipOrderRefund(); chargingOrderRefund.setVipOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); @@ -2544,14 +2556,10 @@ if (tChargingOrder.getCouponDiscountAmount()!=null){ couponDiscount = couponDiscount.add(tChargingOrder.getCouponDiscountAmount()); } - if (tChargingOrder.getRefundStatus()!=null &&tChargingOrder.getRefundStatus() == 2){ - // 如果成功退款 那么减去退款金额 + if (tChargingOrder.getPaymentAmount()!=null){ paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); - }else{ - if (tChargingOrder.getPaymentAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); - } } + } // 三方交易手续费 三方收费*0.6% commissionAmount = sharingAmount.multiply(new BigDecimal("0.006")); @@ -2560,7 +2568,7 @@ tSettlementConfirm.setSharingAmount(sharingAmount.setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setCommissionAmount(commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setElectrovalence(electrovalence.setScale(2, RoundingMode.HALF_DOWN)); - tSettlementConfirm.setServiceCharge(serviceCharge.setScale(2, RoundingMode.HALF_DOWN)); + tSettlementConfirm.setServiceCharge(serviceCharge.subtract(commissionAmount).setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setOrderCommission(orderCommission); tSettlementConfirm.setVipDiscount(vipDiscount); tSettlementConfirm.setCouponDiscount(couponDiscount); @@ -2600,7 +2608,7 @@ tSettlementConfirm.setServiceRemark(dto.getServiceRemark()); tSettlementConfirm.setDistribution(dto.getDistribution()); tSettlementConfirm.setIncome(dto.getElectrovalence().add(dto.getServiceCharge())); - tSettlementConfirm.setCost(dto.getVenue().add(dto.getClean()).add(dto.getMaintain()).add(dto.getMetering())); + tSettlementConfirm.setCost(dto.getVenue().add(dto.getClean()).add(dto.getMaintain()).add(dto.getSupplyElectronic())); tSettlementConfirm.setProfitMoney(chargingElectronic.add(serviceCharge).subtract(tSettlementConfirm.getCost())); tSettlementConfirm.setNewSettlement(subtract2.subtract(tSettlementConfirm.getCost())); @@ -3005,4 +3013,9 @@ } return this.list(queryWrapper.orderByDesc(TChargingOrder::getCreateTime)); } + + @Override + public Long countCar(List<String> brands) { + return this.baseMapper.countCar(brands); + } } -- Gitblit v1.7.1