| | |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.order.mapper.TChargingBillMapper; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.service.TChargingBillService; |
| | | import com.ruoyi.order.service.TChargingOrderRefundService; |
| | | import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | @Override |
| | | public ChargingBillVO chargingBillList1(ChargingListQuery dto) { |
| | | if (dto.getState()!=null){ |
| | |
| | | if (data5.getTime_remaining()!=null){ |
| | | chargingSecond+=data5.getTime_remaining()*60; |
| | | } |
| | | Integer cumulativeChargingTime = data5.getCumulative_charging_time(); |
| | | // 将其转化为xx小时xx分钟xx秒显示 如果是0小时则不展示小时 如果是0分钟则不展示分钟 |
| | | if (cumulativeChargingTime!=null){ |
| | | // 计算小时、分钟和秒 |
| | | int hours = cumulativeChargingTime / 60; |
| | | int minutes = cumulativeChargingTime % 60; |
| | | int seconds = 0; // 如果没有秒数,则默认是0 |
| | | StringBuilder result = new StringBuilder(); |
| | | if (hours > 0) { |
| | | result.append(hours).append("小时"); |
| | | } |
| | | if (minutes > 0) { |
| | | result.append(minutes).append("分钟"); |
| | | } |
| | | if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数 |
| | | result.append(seconds).append("秒"); |
| | | } |
| | | tChargingOrder.setChargingTime(result.toString()); |
| | | } |
| | | tChargingOrder.setEndSoc(data5.getSoc().toString()); |
| | | } |
| | | Integer cumulativeChargingTime = data5.getCumulative_charging_time(); |
| | | // 将其转化为xx小时xx分钟xx秒显示 如果是0小时则不展示小时 如果是0分钟则不展示分钟 |
| | | if (cumulativeChargingTime!=null){ |
| | | // 计算小时、分钟和秒 |
| | | int hours = cumulativeChargingTime / 60; |
| | | int minutes = cumulativeChargingTime % 60; |
| | | int seconds = 0; // 如果没有秒数,则默认是0 |
| | | StringBuilder result = new StringBuilder(); |
| | | if (hours > 0) { |
| | | result.append(hours).append("小时"); |
| | | } |
| | | if (minutes > 0) { |
| | | result.append(minutes).append("分钟"); |
| | | } |
| | | if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数 |
| | | result.append(seconds).append("秒"); |
| | | } |
| | | tChargingOrder.setChargingTime(result.toString()); |
| | | } |
| | | tChargingOrder.setEndSoc(data5.getSoc().toString()); |
| | | |
| | | TAppUser data3 = appUserClient.getUserById(tChargingOrder.getAppUserId()).getData(); |
| | | if (tChargingOrder.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data4 = appUserCarClient.getCarByIds(Arrays.asList(tChargingOrder.getAppUserCarId())).getData(); |
| | |
| | | } |
| | | } |
| | | if (data3!=null)tChargingOrder.setUserName(data3.getName()); |
| | | // 累加实收金额 支付金额减去退款金额 |
| | | if (tChargingOrder.getPaymentAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); |
| | | // 累加实收金额 支付结算金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); |
| | | } |
| | | // 累加订单金额 |
| | | // 入账金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getOrderAmount()); |
| | | } |
| | |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | | electrovalence = electrovalence.add(tChargingOrder.getElectrovalence()); |
| | | } |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus()!=null && tChargingOrder.getRefundStatus()== 2){ |
| | | refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) |
| | | .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); |
| | | for (TChargingOrderRefund tChargingOrderRefund : list2) { |
| | | refundAmount = refundAmount.add(tChargingOrderRefund.getRefundTotalAmount()); |
| | | } |
| | | // 累加累计服务费 |
| | | if (tChargingOrder.getServiceCharge()!=null){ |
| | |
| | | } |
| | | // 累加平台手续费 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006)) |
| | | .setScale(2,RoundingMode.HALF_DOWN)); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006))); |
| | | } |
| | | // 累加平台分佣 |
| | | if (tChargingOrder.getSharingAmount()!=null){ |
| | |
| | | .subtract(chargingBillVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillVO.getCommissionAmount()) |
| | | .subtract(chargingBillVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillVO.getSharingAmount())); |
| | | chargingBillListVO.setPaymentAmount(paymentAmount == null?BigDecimal.ZERO:paymentAmount); |
| | | chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount); |
| | | chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:orderAmount); |
| | | chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount.subtract(refundAmount).subtract(commissionAmount).subtract(sharingAmount)); |
| | | chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:refundAmount); |
| | | chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); |
| | | chargingBillListVO.setServiceCharge(serviceCharge == null?BigDecimal.ZERO:serviceCharge); |
| | | chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); |
| | |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal chargingCapacity = new BigDecimal("0"); |
| | | orderCount+=tChargingOrders.size(); |
| | | chargingBillVO.setCategory(""); |
| | | chargingBillListVO.setOrderCount(tChargingOrders.size()); |
| | | chargingBillVO.setExportList(tChargingOrders); |
| | | |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | |
| | | eq.eq("site_id", chargingBillListVO.getSiteId()); |
| | | } |
| | | List<TChargingOrder> tChargingOrders = chargingOrderList.selectList(eq); |
| | | int chargingSecond = 0; |
| | | orderCount+=tChargingOrders.size(); |
| | | BigDecimal paymentAmount = new BigDecimal("0"); |
| | | BigDecimal orderAmount = new BigDecimal("0"); |
| | | BigDecimal electrovalence = new BigDecimal("0"); |
| | |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal chargingCapacity = new BigDecimal("0"); |
| | | orderCount+=tChargingOrders.size(); |
| | | chargingBillListVO.setOrderCount(tChargingOrders.size()); |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | // 累加实收金额 支付金额减去退款金额 |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ |